Predict NOT Operator Output
Predict Output Easy
Question
What does this code print?
Code
console.log(!true);
console.log(!false);
console.log(!(5 > 3));
Hint
The ! operator flips true to false and false to true.
Explanation
The ! (NOT) operator inverts a boolean. !true = false, !false = true. For !(5 > 3): 5 > 3 is true, so !true = false. The output is: false, true, false (each on its own line).
Related Resources
Related Lessons
- Boolean Logic
Learn about boolean logic and operators.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.