Skip to content

Instantly share code, notes, and snippets.

View QuatoHub's full-sized avatar
🎯
Focusing

Hyeonjun Moon QuatoHub

🎯
Focusing
View GitHub Profile
// isNaN 함수는 지정한 값이 NaN인지 확인하고 그 결과를 불리언 값으로 반환한다.
isNaN(NaN); // true
isNaN(10); // false
isNaN(1 + undefined); // true
// 대소 관계 비교
5 > 0; // true
5 < 0; // false
5 >= 0; // true
5 >= 0; // true
@QuatoHub
QuatoHub / Quato.js
Last active September 11, 2021 09:05
let x = 2;
// 2 % 2는 0이고 0은 false로 암묵적 타입 변환된다.
let result = x % 2 ? "홀수" : "짝수";
console.log(result); // 짝수
// 논리합(||) 연산자
true || true; // true
true || false; // true
false || true; // true
false || false; // false
// 논리곱(&&) 연산자
true && true; // true
true && false; // false
false && true; // false
// 암묵적 타입 변환
!0; // true
!"Hello"; // false
// 단축 평가
"Cat" && "Dog"; // 'Dog'
@QuatoHub
QuatoHub / Quato.js
Last active September 11, 2021 09:05
let x, y, z;
(x = 1), (y = 2), (z = 3); // 3
10 * 2 + 3; // 23
// 그룹 연산자를 사용하여 우선순위를 조절
10 * (2 + 3); // 50
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"
@QuatoHub
QuatoHub / Quato.js
Last active September 11, 2021 09:05
let foo = null;
typeof foo === null; // → false
foo === null; // → true