What are the data types of null and undefined in javaScript?

Directly upload code and screenshots

The results of the operation are as follows:

<script type="text/javascript">
//false "object" "object"
console.log(null instanceof Object, typeof(null), typeof null);
//false "undefined" "undefined"
console.log(undefined instanceof Object, typeof(undefined), typeof undefined);
//true false
console.log(undefined == null, undefined === null);
</script>

The result of console.log(typeof null) is object

The result of console.log(null instanceof Object) is false

Guess you like

Origin blog.csdn.net/czh500/article/details/115258829