代码示例:(标识:eg_js_datatypes_undefined_4)
<!DOCTYPE html>
<html>
<body>

<h2>JavaScript 数据类型</h2>

<p>Undefined and null are equal in value but different in type:</p>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
typeof undefined + "<br>" +
typeof null + "<br><br>" +
(null === undefined) + "<br>" +
(null == undefined);
</script>

</body>
</html>
运行结果: