This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = [1,2,3,,4];//[1,2,3,empty,4] 배열 생성 | |
var b = [1,2,3,,,4];//[1,2,3,empty,empty,4] 배열 생성 | |
var c = [1,2,3,4,,];//[1,2,3,4,empty] 배열 생성 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Array 생성자로 배열 생성 | |
var a = new Array(1);//생성자의 인자가 하나일 땐 해당 인자가 배열의 크기가 된다. | |
var b = new Array(1,2,3,4);//생성자의 인자가 여러 개일 땐 인자들이 배열의 요소가 된다. | |
//배열 리터럴로 배열 생성 | |
var c = [1,2,3]; | |
console.log(a[0],a[1]);//undefined, undefined 출력 | |
console.log(b[0],b[1]);//1 2 출력 | |
console.log(c[0],c[1]);//1 2 출력 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cat = { | |
name: 'James', | |
age: 2 | |
};//cat 객체 생성 | |
console.log(cat.toString());//[object Object] 출력 | |
console.dir(cat); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function a(){ | |
this.a = 1; | |
this.b = 2; | |
}//함수 리터럴로 생성자 함수 생성 | |
var b = new a();//생성자를 통한 객체 생성 | |
console.log(b.a);//1 출력 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = { | |
name: 'Hello', | |
age: 2 | |
}; | |
delete a.name; | |
console.log(a.name);//undefined 출력 | |
delete a['age']; | |
console.log(a['age']);//undefined 출력 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = { | |
column: 3, | |
row: 2 | |
}; | |
//프로퍼티 접근 | |
console.log(a.column);//3 출력 | |
console.log(a['row']);//2 출력 | |
console.log(a.span);//undefined 출력 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = { | |
undefined: 'k', | |
b: 'z', | |
c: 'a' | |
j: 'j' | |
}; | |
var b; | |
var c = 'j'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cat = { | |
name: 'James', | |
age: 2, | |
leg: 4 | |
};//객체 리터럴 방식으로 객체 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = "abc"; a[1] = "d"; | |
console.log(a); // 출력: "abc" // 변경 불가! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Symbol('a') == Symbol('a') //결과: false | |
//각 심볼이 고유의 값을 가지고 있어 서로 다름 | |
Symbol('a') == Symbol.for('a') // 결과: false | |
Symbol.for('a') == Symbol.for('a') //결과: true | |
//전역 레지스트리에서 같은 키의 심볼은 공유하므로 서로 같다. |