Syntax error Explain about logical not(!) operator in detail with example in javascript?

Explain about logical not(!) operator in detail with example in javascript?



NOT operator

The logical NOT operator gives true for false values and false for true values.

 Live Demo

Example

<html>
<body>
<p id="logical"></p>
<script>
   var x = 200;
   var y = 300;
   document.getElementById("logical").innerHTML =
   !(x < y) + "<br>" + !(x > y);
</script>
</body>
</html>

Output

false
true
Updated on: 2019-07-30T22:30:26+05:30

162 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements