Computer >> Computer tutorials >  >> Programming >> Javascript

What is Logical NOT Operator (!) in JavaScript?


The Logical NOT Operator reverses the logical state of its operand. If a condition is true, then the logical NOT operator will make it false.

<html>
   <body>
      <script>
         var a =true;
         document.write("a = ");
         document.write(a);
         result =!a;
         document.write("<br>!a = ");
         document.write(result);
      </script>
   </body>
</html>