Last active
September 11, 2021 09:06
-
-
Save QuatoHub/77ef8823c4d266c932c75c97f6ad377b to your computer and use it in GitHub Desktop.
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 | |
// 부수 효과는 없다. | |
console.log(x); // "1" | |
// 불리언 값을 숫자로 타입 변환한다. | |
x = false; | |
console.log(+x); // 0 | |
// 부수 효과는 없다. | |
console.log(x); // "0" | |
// 문자열을 숫자로 타입 변환할 수 없으므로 NaN을 반환한다. | |
x = "Hello"; | |
console.log(+x); // NaN | |
// 부수 효과는 없다. | |
console.log(x); // "Hello" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment