Course

Logical Operators Part 3 (!NOT)

Loading...

In this lesson, you'll learn about the operator in JavaScript, which inverts the truthiness of values, helping you manage conditions effectively.

Not Operator

An exclamation sign is known as the NOT operator. It reverses the boolean result of the condition.

The syntax is pretty simple:

console.log(!true); // false

The operator accepts a single argument and does the following:

  1. Converts the operand to boolean type: .
  2. Returns the inverse value.

For instance:

console.log(!true); // false
console.log(!0); // true

Double Not Operator

A double NOT is sometimes used for converting a value to boolean type:

console.log(!!"truthy"); // true
console.log(!!null); // false
Loading...

0 Comments

"Please login to view comments"

glass-bbok

Join the Conversation!

Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.

Upgrade your account
tick-guideNext Lesson

'switch' Statement