# DAY19 - JavaScript 17. 數值屬性 NaN - NaN 也是 number 型別的一種,只是**它顯示數值不正常**的意思 翻譯: 這不是一個數字的意思。 ### 實際範例: 1. 亂用字串去做數字加減乘除: ``` let myName = "chen"; console.log(myName * 20); // NaN ``` 2. 用 `parseInt()` 企圖將字串做轉型? - 這邊可以看到, `str` 是一個**字串型別的變數**,內容「hello!」 基本上,這是一個不可能變成數字的內容 xd ``` let str = "hello!"; console.log(parseInt(str)); ``` ###### tags: `Re:0 前端工程師之路 - JavaScript 字串 篇章`
×
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