The exclamation operator is to perform negation on an expression.
Example
You can try to run the following code to learn how to implement exclamation(!) operator in JavaScript −
<html>
<head>
<title>JavaScript Boolean</title>
</head>
<body>
<script>
var answer = true;
document.write(answer);
document.write("<br>"+!answer);
</script>
</body>
</html>