feat: added info about typeof null (#26899)
* feat: added info about typeof null * Further clarify changepull/35399/head
parent
ef625c80c6
commit
0f905531df
|
@ -83,11 +83,15 @@ Even thought this is a useful validation method, we have to be careful because j
|
||||||
```javascript
|
```javascript
|
||||||
var x = [1,2,3,4];
|
var x = [1,2,3,4];
|
||||||
console.log(typeof x) // object
|
console.log(typeof x) // object
|
||||||
|
|
||||||
console.log(typeof null) // 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:
|
### 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>
|
<a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof' target='_blank' rel='nofollow'>MDN Documentation for typeof</a>
|
||||||
|
|
Loading…
Reference in New Issue