The negation operator (!) simply just reverses the meaning of its operand.
In the below image, I am using Chrome developer tools to demonstrate this example
In the above example, we are setting the variable
When we first log the value of
sleeping on the console, it gives us an output of
However, when we negate the variable by prefixing it with an exclamation mark;
!sleeping the output is changed to true.