This file contains 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 = new Object();//Object() 생성자 함수를 통한 cat 객체 생성 | |
cat.name = 'James';//cat객체의 프로퍼티 설정 | |
cat.age = 2; | |
cat.leg = 4; |
This file contains 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 = "a"; //a는 이제 string 타입 | |
a = 1; //a는 이제 number 타입 | |
a = true; //a는 이제 boolean 타입 | |
a = null //a는 이제 null 타입 | |
a = undefined //a는 이제 undefined 타입 |
This file contains 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
-0 === 0 // true | |
1 / 0 //Infinity | |
1 / -0 //-Infinity |
This file contains 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 | |
//전역 레지스트리에서 같은 키의 심볼은 공유하므로 서로 같다. |
This file contains 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 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 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 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 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 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 출력 |
OlderNewer