자바스크립트 기본 문법
- 자바스크립트는 컴파일을 하지 않는다. -> 즉 런타임 시에 타입이 결정된다!!
선언만 하면 undefined 상태이다.
- var 쓰지말기 const나 let을 사용해야 한다.
let name = "이순신"
name = "김정수"
console.log(name);
const name1 = "이순신";
console.log(name);
for(let i = 0; i<9;i++){
console.log(i);
}
function checkType(value){
return typeof value;
}
checkType => (value2) => {
return typeof value2
}
console.log(checkType(5));
console.log(checkType("문자"));
console.log(checkType({}));
console.log(checkType(null));
const fruits = ['🥝','🥥','🍌']
console.log(typeof fruits);
console.log(checkType(function(){}));

window.addEventListener(
"hashchange",
() => {
console.log(location.hash.substring(1));
},
false,
);

- 자바스크립트에서의 얕은복사 kiwi와 tomato는 같은 주소번지를 바라보고 있다.

let kiwi = {
name:"kiwi",
display : "🥝"
}
let tomato = kiwi
console.log(kiwi);
console.log(tomato);
tomato.display= "🍅"
kiwi.name = "tomato"
console.log(tomato);
console.log(kiwi);
console.log(tomato['display']);