What is an exclamation “!” operator in JavaScript?

JavascriptWeb DevelopmentFront End Technology

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 −

Live Demo

<html>
   <head>
      <title>JavaScript Boolean</title>
   </head>

   <body>
      <script>
         var answer = true;
         document.write(answer);
         document.write("<br>"+!answer);
      </script>
   </body>
</html>
raja
Published on 18-Jan-2018 17:34:11
Advertisements