เพื่อตรวจสอบค่า null ใน JavaScript ต้องตรวจสอบค่าตัวแปรกับ null ใช้ตัวดำเนินการเทียบเท่าที่เข้มงวด (strict equality operator) ของ JavaScript
ตัวอย่าง
ลองรันโค้ดด้านล่างเพื่อตรวจสอบว่าค่าของตัวแปรเป็น null หรือไม่
<html>
<head>
<title>JavaScript Strict Equality Operator</title>
</head>
<body>
<script>
var a = 10;
if (a === null) {
document.write("Value is null");
} else {
document.write("Value is not null");
}
</script>
</body>
</html>