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

<p>将 5 赋给 x,并显示比较的值 (x! == "5"):</p>

<button onclick="myFunction()">试一试</button>

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

<script>
function myFunction() {
  var x = 5;
  document.getElementById("demo").innerHTML = (x !== "5");
}
</script>

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