๊ณต๋ถ์ ์์๊ณผ ๋์ ๋ฌด์กฐ๊ฑด ๋ณต์ต!
๋ณต์ตํ๋ ํ์คํ ๋ด์ฉ ์ ๋ฆฌ๊ฐ ์ ๋๋ค
๐ ์ดํํ ์ฝ๋ฉ ์๊ฐ 10hour
๐๐ผ -
๐๐ผ -
์ธํฐ๋ท: ์ปดํจํฐ๊ฐ ์๋ฒ์ ํด๋ผ์ด์ธํธ๋ก ์ฐ๊ฒฐ๋์ด ์ ๋ณด ์ฃผ๊ณ ๋ฐ์
url: ์ปดํจํฐ ๋คํธ์ํฌ์ ๊ฒ์ ๋ฉ์ปค๋์ฆ์์์ ์์น๋ฅผ ์ง์ ํ๋ ์น ๋ฆฌ์์ค์ ๋ํ ์ฐธ์กฐ, ์ปดํจํฐ ๋คํธ์ํฌ ์์ ์์์ด ์ด๋ ์๋์ง ์๋ ค์ฃผ๊ธฐ ์ํ ๊ท์ฝ, ์ธํฐ๋ท ์ฃผ์
ํต์ ํ๋กํ ์ฝ: ์ปดํจํฐ๋ ์๊ฑฐ๋ฆฌ ํต์ ์ฅ๋น์์ ๋ฉ์์ง๋ฅผ ์ฃผ๊ณ ๋ฐ๋ ์์๊ณผ ๊ท์น์ ์ฒด๊ณ
HTTP: ํ๋กํ ์ฝ, ํต์ ๊ท์ฝ -> ์ปดํจํฐ๊ฐ ๋ค๋ฅธ ์ปดํจํฐ์ ๋ฉ์์ง๋ฅผ ์ฃผ๊ณ ๋ฐ์ ์ ์๋ค, W3 ์์์ ์ ๋ณด ์ฃผ๊ณ ๋ฐ์ ์ ์๋ ํ๋กํ ์ฝ, ํด๋ผ์ด์ธํธ์ ์๋ฒ ์ฌ์ด์ ์ด๋ฃจ์ด์ง๋ ์์ฒญ/์๋ต ํ๋กํ ์ฝ
ํ์ดํผํ
์คํธ: ํ์ดํผ๋งํฌ๋ฅผ ํตํด ๋
์๊ฐ ํ ๋ฌธ์์์ ๋ค๋ฅธ ๋ฌธ์๋ก ์ ๊ทผํ ์ ์๋ ํ
์คํธ
์น: ์ปจํ
์ธ ๋ค์ด ํ์ดํผํ
์คํธ๋ก ๋ฌถ์ธ ์งํฉ
HTML: ํ์ดํผํ
์คํธ ๋งํฌ์
์ธ์ด, ๊ตฌ์กฐ์ ๋ฌธ์
๋งํฌ์
์ธ์ด: ํ๊ทธ๋ฅผ ์ด์ฉํ์ฌ ๋ฌธ์๋ ๋ฐ์ดํฐ์ ๊ตฌ์กฐ๋ฅผ ๋ช
๊ธฐํ๋ ์ธ์ด์ ํ ๊ฐ์ง
W3(WWW): ์น, ์ธํฐ๋ท์ ์ฐ๊ฒฐ๋ ์ปดํจํฐ๋ฅผ ํตํด ์ฌ๋๋ค์ด ์ ๋ณด๋ฅผ ๊ณต์ ํ ์ ์๋ ์ ์ธ๊ณ์ ์ธ ์ ๋ณด ๊ณต๊ฐ
์น ๋ธ๋ผ์ฐ์ : ์น ์๋ฒ์์ navigateํ๋ฉฐ ์๋ฐฉํฅ ํต์ ํ๊ณ html ๋ฌธ์๋ ํ์ผ์ ์ถ๋ ฅํ๋ ์ํํธ์จ์ด, http ์ํํธ์จ์ด ์์ด์ ํธ (e.g. ํฌ๋กฌ, ์ฃ์ง, ์คํ๋ผ, ์ฌํ๋ฆฌ, ํ์ด์ดํญ์ค)
<tag attribute=""> // <ํ๊ทธ ์์ฑ="์์ฑ๊ฐ'></ํ๊ทธ> (elements(์์))
<html>
<head>
<meta charset="UTF-8" /> <!--๋ฌธ์ ์ค๋ช
, ๊ฒ์์ด, ๋ฌธ์ ๋ถํธ์ฒ๋ฆฌ ๋ฐฉ์-->
<title> ๋ธ๋ผ์ฐ์ ํด๋ฐ ์๋จ ๋ฌธ์ ์ ๋ชฉ <title>
<style type="text/css">
body {color:red;}</style> <!--internal ๋ฐฉ์์ ์คํ์ผ-->
</style>
<script type="text/javascript">
alert('์๋ฐ์คํฌ๋ฆฝํธ ์ฐ๊ฒฐ, defer์ ํจ๊ป ์ฌ์ฉํ๊ธฐ');
</script>
<link rel="stylesheet" href="style.css"/> <!--style sheet external ์ฐ๊ฒฐ-->
</head>
<body>
<header> ์น ํ์ด์ง ์๋จ ์์ญ
<nav> ๋ค๋น๊ฒ์ด์
๋งํฌ ๊ทธ๋ฃน </nav>
</header>
<hgroup>
<h1> ์ ๋ชฉ, 6๊น์ง ์ธ ์ ์์ </h1>
<h2> hgroup์ ์ ๋ชฉ-๋ถ์ ๋ชฉ์ ๋ค๋จ๊ณ ์ ๋ชฉ ์ค์ , ํ์ง๋ง html5์์ ์ญ์ ๋จ </h2>
</hgroup>
<p>๋ฌธ๋จ, ๋จ๋ฝ ์์ฑ
<span> ์ธ๋ผ์ธ ์์, ํน์ ๋ถ๋ถ ์คํ์ผ ์ ์ฉ, p ํ๊ทธ ์์ ์ฌ์ฉํ๊ธฐ๋ </span>
<dfn> ์ฉ์ด๊ฐ ์ฒ์ ๋ฑ์ฅํ ๋ ์ ์, ์ ๋ฌธ์ด ์ ์ - ๋ถ๋ชจ ์์์ ์ค๋ช
ํฌํจ </dfn>
<abbr title="์ฝ์์ ๋ป"> ์ฝ์, ๋ง์ฐ์ค ์ฌ๋ ธ์ ๋ ๋ป ๋ํ๋จ </abbr>
<q> ์งง์ ์ธ์ฉ๊ตฌ </q>
<b> ๊ธ์จ๋ฅผ ๊ตต๊ฒ </b>
<strong> ๊ธ์ ๊ตต๊ฒ ํด์ ํ
์คํธ ์ค์ํ๊ฒ </strong>
<em> ํน์ ํ
์คํธ ๊ฐ์กฐ, ์ดํค๋ฆญ์ฒด </em>
<i> ์ดํค๋ฆญ์ฒด </i>
<ins> ๋ณ๊ฒฝ ํ ์ถ๊ฐ๋ ๋ด์ฉ ํ์, ๋ฐ์ค </ins>
<del> ๋ณ๊ฒฝ ํ ์ญ์ ๋ ๋ด์ฉ ํ์, ๊ฐ์ด๋ฐ ๋ผ์ธ </del>
<br> ์ค๋ฐ๊ฟ ํ๊ทธ
<pre>
ํ๊ทธ ์์ ํญ, ์ํฐ, ์คํ์ด์ค ํํ๋จ
</pre>
<p><sup>1</sup>/<sub>2</sub> + <sup>1</sup>/<sub>2</sub> = 1</p>
<!--sup์ squared, sub์ baseline-->
1 < 6 <!--entity code ์จ์ฃผ๊ธฐ-->
</p>
<blockquote>
๋ค๋ฅธ ์์์์ ์ธ์ฉํ ์ผ๋ถ ์ง์ , ์ธ์ฉ๋ฌธ, ๋ค์ฌ์ฐ๊ธฐ ๋จ
<cite> ์ ์๋ฌผ์ ์ถ์ฒ ํ๊ธฐ, ๊ทธ๋ฆผ, ์ฑ
, ์ํ ์ด๋ฆ ๋ฑ, ์ดํค๋ฆญ์ฒด </cite>
</blockquote>
<ol><li> ์์๊ฐ ์๋ ๋ชฉ๋ก </li></ol>
<ul><li> ์์๊ฐ ์๋ ๋ชฉ๋ก </li></ul>
<dl> ์ฉ์ด ์ค๋ช
๋ชฉ๋ก
<dt> ์ฉ์ด์ ์ ๋ชฉ </dt>
<dd> ์ฉ์ด ์ค๋ช
</dd>
</dl>
<hr> <!--ํ๋ฉด ๊ฐ๋ก์ง๋ฅด๋ ๋ผ์ธ-->
<table>
<thead><th> th๋ ์ด์ ์ ๋ชฉ </th><th></th></thead>
<tbody><th></th><td> td๋ ๋ด์ฉ </td></tbody>
<tfoot><tr><td colspan="2"> tr๋ก ํ ์์ฑ </td></tr></tfoot>
</table>
<code> ์ปดํจํฐ ์ฝ๋์ ์ผ๋ถ๋ถ ๋ํ๋ </code>
<div> ๋ ์ด์์ ๋ถํ , ๋ธ๋ก ๋ ๋ฒจ ์์, ์น์
๋ง๋ค ๋, ์๋ฏธ์ ๊ด๊ณ ์์ ๋
<img src="ddd.jpg" alt="ddd"> <!--์ด๋ฏธ์ง ์ฝ์
-->
</div>
<form>
<label for="dd"> ํผ ์์์ ์ด๋ฆ ๋ถ์ด๋ ํ๊ทธ </label>
<input type="text" id="dd">
<textarea> ์ฌ๋ฌ ์ค์ ํ
์คํธ ์
๋ ฅ </textarea>
</form>
<select name="job">
<option value="ํ์">ํ์</option>
</select>
<button type="button"> inputํ์
๊ณผ ๋ฌ๋ฆฌ ํ
์คํธ๋ ์ด๋ฏธ์ง ๋ฃ์ ์ ์์ </button>
<source src="url">
<!--์ ๋ ์ฃผ์ ํน์ ์๋ ์ฃผ์๋ฅผ ๋ช
์ํ์ฌ ์ฌ์ํ ๋ฏธ๋์ด ํ์ผ ๋ณด์ฌ์ค, ์ค๋์ค, ๋น๋์ค-->
<iframe src="http://dd.com"> ์ธ๋ผ์ธ ํ๋ ์, ๋ค๋ฅธ ๋ฌธ์ ํฌํจ </iframe>
<figure>
<audio src="http://dd.com"> ์์ฑํ์ผ ์ฌ์ </audio>
<video src="http://dd.com"> ์์ํ์ผ ์ฌ์ </video>
<figcaption> ์ฌ์ง, ๋น๋์ค, ์ค๋์ค ๋ฑ ๋ด๋ ์ปจํ
์ด๋, ๋ด์ฉ๊ณผ ์ฐ๊ด </figcaption>
</figure>
<aside> ๋ถ์ฐจ์ ๋ด์ฉ, ๋ฐ๊นฅ ์์ญ, ๋์จํ๊ฒ ๊ด๋ จ๋ ๋ด์ฉ </aside>
<article> ๋ณธ๋ฌธ ํ์
, ๋
์์ ์ผ๋ก ์์ฑ๋ ์ปจํ
์ธ </article>
<section> ์๋ก ๊ด๊ณ์๋ ๋ฌธ์๋ฅผ ๋ถ๋ฆฌ </section>
<main>
body ์์์ ์ฃผ ์ฝํ
์ธ ๋ฅผ ์ ์ํ๋ค, ์ง์ ์ ์ผ๋ก ์ค์ฌ ์ฃผ์ ์ฌ์ผ ํ๊ณ ๋ฐ๋ณต๋๋ ๋ด์ฉ์ ์ ๋จ, ๋ฌธ์ ๋ด์ ๋จ ํ๋๋ง ์กด์ฌํด์ผ ํ๋ฉฐ ๋ค๋ฅธ article, aside, footer, header, nav์ ์์ ์์ ์ ๋จ
</main>
<details>
<summary> summary๊ฐ details์ 1๋ ์์ ์์๋ก ๋์์ผ ํ๋ค</summary>
<p> details๋ ๋๋ณด๊ธฐ/์ ๊ธฐ ๊ธฐ๋ฅ์ ์์ญ์ ๊ฐ์ผ๋ค </p>
</details>
<time datetime="YYYY-MM-DDThh:mm:ssTZD|PTDHMS">
<!--time tag๋ก ์์์ ๋ ์ง์ ์๊ฐ ๋ฐ์ดํฐ๋ฅผ machine-readable ํํ๋ก ๋ช
์ํ๋ค-->
<footer>
๊ผฌ๋ฆฟ๋ง, ๋ฌธ์์ ์ ๋ณด
<address> ๊ธ์ ์ ์๋ ํ์ฌ์ ์ฐ๋ฝํ ์ ์๋ ์ ๋ณด </address>
</footer>
</body>
style์ ์ธ ๊ฐ์ง ๋ฐฉ์์ผ๋ก ์ฝ์
๊ฐ๋ฅ
1. inline: ํ๊ทธ ์์ฑ์ฒ๋ผ ์ฌ์ฉ
2. internal: head์ style tag๋ก ์ฝ์
3. external: .css ์ ์ฅ ํ link ํ๊ทธ ์ฌ์ฉ
semantic web: ์๋ฏธ๋ก ์ ์ธ ์น -> SEO
{ property: value; }
universal, multiple(,), id(#), class(.), descendant( ), adjacent(+), direct(>)
attribute([type="text"])
ํ์ ์ ํ์์ ์์ ์ ํ์
ํ์ ์ ํ์ section ul -> ๋ชจ๋ ํ์ ์์์ ์คํ์ผ ์ ์ฉ
์์ ์ ํ์ section>ul -> ๋ถ๋ชจ์ ๋ฐ๋ก ์๋ ์์ ์์์๋ง ์ ์ฉ
์ธ์ ํ์ ์ ํ์์ ์ผ๋ฐ ํ์ ์ ํ์
e+f adjacent sibling combinator, e ์์ ๋ค๋ฐ๋ฅด๋ f ์์ -> ์ฒซ๋ฒ์งธ ๋์์์์๋ง ์ ์ฉ
e~f general sibling combinator, e ์์๊ฐ ์์ ์กด์ฌํ๋ฉด f ์ ํ -> ๋ชจ๋ ๋์์์์ ์ ์ฉ
border ๋๋ฌธ์ box size ์ปค์ง๋ ๋ฌธ์ ํด๊ฒฐ -> box-sizing: border-box;
static, relative, absolute, fixed, sticky
grid-template: 1fr 50px/20% 80%;
grid-column-start:3;
grid-column-end:5; /*๋ง์ง๋ง ์๋ ํฌํจํ์ง ์๋๋ค*/
grid-column-end: span 2;
/*grid-column: 3 / 5;*/
grid-column: 2/6;
grid-row: span 5;
/*grid-area: 1 / 2 / 6 / 6;*/
.box1 {align-self: start;}
.box4 {align-self: end;}
.box4 {justify-self: end;}
" hello ".trim().toUpperCase()//"HELLO"
let tvShow = 'catdog';
tvShow.indexOf('cat'); //0
tvShow.slice(0,3); //'cat' -> new copy
tvShow.slice(3); //'dog; -> new copy
tvShow.replace('cat','dog'); //'dogdog' -> ์ฒซ๋ฒ์งธ๋ง ๋ฐ๊ฟ
tvShow.repeat(3) //'dogdogdog'
`Total is: $${price*qty}`//template literals
Math.PI //3.14159265
Math.round(4.9) //5 //Rounding a number
Math.abs(-456) //456 //Absolute value
Math.pow(2,3) //8 //Raises 2 to the 3rd power=2**3
Math.floor(3.999) //3 //Removes decimal
Math //object ๋ณผ ์ ์์
Math.ceil(34.1) //35 //Round up
Math.random(); //0.328923749
Math.floor(Math.random()*10)+1; //1 to 10
parseInt(userInput) // string์ด ์ซ์๋ก ๋ณํจ
const day = prompt('Enter a day').toLowerCase();
if (day==='monday') {console.log("You are a baby");
} else if (day==='saturday') {console.log("You are a child");
} else if (day==='friday') {console.log("You are an adult");
} else {console.log ("You are a senior.");
}
array methods: push, pop, shift, unshift
let cats = ['blue', 'kitty']
let dogs = ['rusty', 'wyatt']
let party = cats.concat(dogs) //(4) ["blue", "kitty", "rusty", "wyatt"]
cats.includes('blue') //true
party.indexOf('kitty') //1 //์ฒซ๋ฒ์งธ๋ง ์ฐพ๋๋ค
party.reverse() //["wyatt", "rusty", "kitty", "blue"]
party.slice(1) //["rusty", "kitty", "blue"]
party.slice(2,4) //["kitty", "blue"]
party.slice(-1) //["blue"]
party.splice(1,1) //["wyatt", "kitty", "blue"]
party.splice(1,0,"bruno") //["wyatt", "bruno", "kitty", "blue"]
๋ ํผ๋ฐ์ค๊ฐ ๋ณํ์ง ์๋๋ค๋ฉด ๊ฐ์ ๋ณํ ์ ์๋ค
์๋ฐ์คํฌ๋ฆฝํธ์ ๊ฐ์ฒด๋ ํค(key)๊ณผ ๊ฐ(value)์ผ๋ก ๊ตฌ์ฑ๋ ํ๋กํผํฐ(Property)๋ค์ ์งํฉ
๊ฐ์ฒด๋ ๋ฐ์ดํฐ๋ฅผ ์๋ฏธํ๋ ํ๋กํผํฐ(property)์ ๋ฐ์ดํฐ๋ฅผ ์ฐธ์กฐํ๊ณ ์กฐ์ํ ์ ์๋ ๋์(behavior)์ ์๋ฏธํ๋ ๋ฉ์๋(method)๋ก ๊ตฌ์ฑ๋ ์งํฉ
๋ชจ๋ ํค๋ string์ผ๋ก ๋ณํ๋จ (symbol๋ง ๋นผ๊ณ )
person["lastName"] //Jagger
person.lastName //Jagger
ordered data : array
unordered data : object
const comments =[
{username: 'Tammy', text: 'lololol'. votes: 9},
{username: 'FishBoi', text: 'glub glub'. votes: 123}
]
comments[1].text //"glub glub"
const animals = [ 'lions','tigers','bears'];
for (let i=0; i<animal.lenth; i++) {
console.log(i, animals[i]); }
let num = 0;
while (num<10) {
console.log(num);
num++;
}
const subreddits = ['cringe', 'books', 'funny', 'soccer', 'pics']
for (let i = 0; i < subreddits.length; i++) {
console.log(`Visit reddit.com/r/${subreddits[i]}`)
}
for (let sub of subreddits) {
console.log(`Visit reddit.com/r/${sub}`)
}
let total=0;
for (let score of Object.values(testScores)) {
total+= score;
}
console.log(total / scores.length)
scope
lexical scope: ํจ์์ ์ ์ธ์ ๋ฐ๋ผ ์์ ์ค์ฝํ๊ฐ ๊ฒฐ์ ๋๋ค
forEach
const numbers = [1,2,3,4,5]
numbers.forEach(function (el) {
console.log(el)
})
// ์ด๊ฑด ์์ฆ์ ๋ ์๋ก์ด ๋ฐฉ์, for์ ์ด์ฉํด์ elment ๋ถ๋ฌ์ค๊ธฐ
for (let el of numbers) {
console.log(el);
}
map
//1
function cleanNames(arr) {
const newArr = arr.map(function(name){
return name.trim();
})
return newArr;
}
//2
function cleanNames = arr => {
const newArr = arr.map(function(name) {
return name.trim();
};
//3
function cleanNames = arr => arr.map(name => name.trim());
์๋ฐ์คํฌ๋ฆฝํธ์ this๋ ํธ์ถํ๋ ๋ฐฉ๋ฒ์ ๋ฐ๋ผ ๊ฒฐ์ ๋๋ค
ํธ์ถ์ ์ด๋ป๊ฒ ํ๋, ๋๊ฐ ํ๋
ํธ์ถํ ๋(๊ฐ์ฒด), ๋๊ฐ ์คํํ๋ === this
var someone = {
name: 'codejong',
whoAmI : function() {
console.log(this);
}
};
someone.whoAmI(); //dot notation ๋ฐฉ์์ผ๋ก someone์ด ํธ์ถํ์ผ๋ฏ๋ก someone์ด this
var myWhoAmI = someone.whoAmI;
myWhoAmI(); //regular function call ๋ฐฉ์์ผ๋ก global(window)์์ ์คํํ์ผ๋ฏ๋ก this๋ window
<script>
var btn = document.getElementById('btn');
btn.addEventListener('click',someone.whoAmI);
// boom...button์ด ํธ์ถ๋จ, ํจ์๋ฅผ ๋ฒํผ์ ๋๊ฒจ์ค ๊ฒ. ์คํํ ์ ๋ ๋ฒํผ
</script>
bind(๋ฐ์ธ๋ฉ)
var bindedWhoAmI = myWhoAmI.bind(someone);
btn.addEventListener('click',someone.whoAmI); //someone
๋์ ํ์ ์ ๊ฐ์ง ์ํ์ ์ ๋ชฉ๋ง ๋ถ๋ฌ์ค๊ธฐ
movies.filter(m=>m.score>80).map(m=>m.title);
๋ณต์ต๋งํฌ
์ฐธ๊ณ ๋งํฌ: zerocho
-> map ๊ณผ filter ๊ฐ์ ํจ์ํ ๋ฉ์๋๋ฅผ reduce๋ก ๊ตฌํํ ์ ์๋ค
traditional function์ ํจ์๊ฐ ์คํ๋๋ ๊ณณ์ ์ํฅ์ ๋ฐ๋๋ค
ํ์ง๋ง arrow functiondms ํจ์๊ฐ ๋ง๋ค์ด์ง ๊ณณ์ scope๋๋ค
normal function already create the variable with the function keword
function sum(a,b){ return a+b; }
but arrow function, we have to create own variable to store the function
let sum2 = (a,b) => a+b;
arrow function์ ์ต๋ช ํจ์์์ ๋น์ ๋ฐํ๋ค
class vs object
object-oriendted
class person{
name; //property - ์์ฑ(field)
speak(); //function - ํ๋(method)
}
property
์ด๋ค ๊ฐ์ด ๋ค๋ฅธ ๊ฐ๊ณผ ์ฐ๊ด์ ๊ฐ์ง๊ณ ์์ ๋
๋ฌธ์์ด.length ์์ length๋ฅผ ํ๋กํผํฐ๋ผ ํ๋ค
๊ฐ์ฒด์ ์์๋ ํจ์ -> ๋ฉ์๋ (e.g. cowokers.showAll())
๊ฐ์ฒด์ ์์๋ ๋ณ์ -> ํ๋กํผํฐ (e.g. var cowokers = { 'programmer':'egoing'} ์์ programmer
-> ๊ฐ์ ๊ฒ์ด๋ผ๋ ๋งฅ๋ฝ์ ๋ฐ๋ผ ๋ถ๋ฅด๋ ๊ฒ์ด ๋ค๋ฅด๋ค