JavaScript Basics

JavaScript Advanced

JavaScript Arrays

JavaScript Functions

JavaScript Objects

JavaScript DOM

JavaScript String

What is Logical NOT (!) operator in JavaScript?

Logical NOT operator is represented by the exclamatory (!) symbol. It is a unary operator.

Here is how you use the logical NOT operator in JavaScript.


The ! operator is written before an operand. It returns true if an operand evaluates to falsy. If an operand is truthy then it returns false. In simple terms, it returns true or false.

In JavaScript, you know null, undefined, NaN, 0, and "" are falsy values. You can verify this by applying the logical NOT operator twice.

console.log(!!null); //false
console.log(!!undefined); //false
console.log(!!NaN); //false
console.log(!!0); //false
console.log(!!""); //false

Recommended Posts