Please enable JavaScript to use CodeHS

CodeHS Glossary


Not operator JavaScript

Logical operator that negates a single boolean value. Written as !. !a will be true if a is false, and false if a is true.

You can think of it as being the opposite of the given boolean value.

var raining = true;
var isSunnyToday = !raining;   // isSunnyToday will be false