console.log(typeof NaN); // number
console.log(Number([])); // 0
console.log(Number(![])); // 0
console.log(Number([2])); // 2
console.log(Number([0,0])); // NaN
**
undefined means this thing has no value for some reason. Most of the times you encounter undefined it means that something has gone wrong.
On the other hand, null means this thing has no value, I recognise this and it's the way I would like it to be. 看見null表示是編寫者故意設的typeof(undefined) | Should output ← "undefined" |
typeof(null) | Should output ← "object" This is regarded by many as a mistake in the language. It's too late to fix it now so we'll have to deal with it. |
沒有留言:
張貼留言