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 |
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
// isNaN 함수는 지정한 값이 NaN인지 확인하고 그 결과를 불리언 값으로 반환한다. | |
isNaN(NaN); // true | |
isNaN(10); // false | |
isNaN(1 + undefined); // 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 > 0; // true | |
5 < 0; // false | |
5 >= 0; // true | |
5 >= 0; // 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
// 논리합(||) 연산자 | |
true || true; // true | |
true || false; // true | |
false || true; // true | |
false || false; // false | |
// 논리곱(&&) 연산자 | |
true && true; // true | |
true && false; // false | |
false && true; // 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
// 암묵적 타입 변환 | |
!0; // true | |
!"Hello"; // 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
// 단축 평가 | |
"Cat" && "Dog"; // 'Dog' |
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
10 * 2 + 3; // 23 | |
// 그룹 연산자를 사용하여 우선순위를 조절 | |
10 * (2 + 3); // 50 |
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
typeof ""; // → "string" | |
typeof 1; // → "number" | |
typeof NaN; // → "number" | |
typeof true; // → "boolean" | |
typeof undefined; // → "undefined" | |
typeof symbol(); // → "symbol" | |
typeof null; // → "object" | |
typeof []; // → "object" | |
typeof {}; // → "object" | |
typeof new Date(); // → "object" |
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
2 ** 2; // → 4 | |
2 ** 2.5; // → 5.65685424949238 | |
2 ** 0; // → 1 | |
2 ** -2; // → 0.25 |