feat: added info about typeof null (#26899)

* feat: added info about typeof null

* Further clarify change
pull/35399/head
v01d3tr 2019-02-25 05:43:49 +01:00 committed by Manish Giri
parent ef625c80c6
commit 0f905531df
1 changed files with 6 additions and 2 deletions

View File

@ -83,11 +83,15 @@ Even thought this is a useful validation method, we have to be careful because j
```javascript
var x = [1,2,3,4];
console.log(typeof x) // object
console.log(typeof null) // object
```
The last example above is a well-known JavaScript 'mistake' and a fix was proposed in ECMAScript, which would have resulted in:
```javascript
typeof null === 'null' // true
```
But due to major legacy issues it had to be rejected.
### More Information:
<a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof' target='_blank' rel='nofollow'>MDN Documentation for typeof</a>