--- title: 練習 - 型別陷阱題 tags: JS 直播班 - 每日練習 --- 練習 - 型別陷阱題 --- 以下變數 a, b, c, d 它們的值、型別各自為何? ( 請先想想看,不要用 console.log 檢查 ) ```jsx= let a = true + true ; let b = false + 123 ; let c = null + 123 ; let d = null + '123'; ``` 回答: ``` // true === 1; // a = 2, number // false === 0; // b = 123, number // null有被賦予值,但是「空值」 // c = 123, number // 等同字串相加 // d = 'null123', string ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up