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
// 심벌 값 생성 | |
let key = Symbol("key"); | |
console.log(typeof keey); // symbol | |
// 객체 생성 | |
let obj = {}; | |
// 이름이 충돌할 위험이 없는 유일무이한 값이 심벌의 프로퍼티 키로 사용 | |
obj[key] = "value"; | |
console.log(obj[key]); // value |
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
5 + 2; // 7 | |
5 - 2; // 3 | |
5 * 2; // 10 | |
5 / 2; // 2.5 | |
5 % 2; // 1 |
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
// ++ 연산자는 피연산자의 값을 변경하는 암묵적 할당이 이뤄진다. | |
x++; // x = x + 1; | |
console.log(x); // 2 | |
// -- 연산자는 피연산자의 값을 변경하는 암묵적 할당이 이뤄진다. | |
x--; // x = x - 1; | |
console.log(x); // 1 |
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
let x = 5, | |
result; | |
// 선할당 후증가(postfix increment operatior) | |
result = x++; | |
console.log(result, x); // 5 6 | |
// 선증가 후할당(prefix increment operatior) | |
result = ++x; | |
console.log(result, x); // 7 7 |
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
let x = "1"; | |
// 문자열을 숫자로 타입 변환한다. | |
console.log(+x); // 1 | |
// 부수 효과는 없다. | |
console.log(x); // "1" | |
// 불리언 값을 숫자로 타입 변환한다. | |
x = true; | |
console.log(+x); // 1 |
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
// 문자열 연결 연산자 | |
"1" + 2; // '12' | |
1 + "2"; // '12' |
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
let x; | |
// 할당문은 표현식인 문이다. | |
console.log((x = 10)); // 10 |
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
// 동등 비교 | |
5 == 5; // true | |
// 타입은 다르지만 암묵적 타입 변환을 통해 타입을 일치시키면 동등하다. | |
5 == "5"; // 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
// 일치 비교 | |
5 === 5; // true | |
// 암묵적 타입 변환을 하지 않고 값을 비교한다. | |
// 즉, 값과 타입이 모두 같은 경우만 true를 반환한다.. | |
5 === "5"; // false |
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
// NaN은 자신과 일치하지 않는 유일한 값 | |
NaN ==== NaN; // false |