感叹号运算符将对表达式执行否定。
您可以尝试运行以下代码,以了解如何在JavaScript中实现exclamation(!)运算符-
<html>
<head>
<title>JavaScript Boolean</title>
</head>
<body>
<script>
var answer = true;
document.write(answer);
document.write("<br>"+!answer);
</script>
</body>
</html>