What is the output of the expression !!null;

Prepare for the Salesforce JavaScript Developer Exam. Utilize comprehensive quizzes, flashcards, and multiple choice questions with hints and explanations. Boost your exam readiness!

The expression !!null is a double negation of the value null. In JavaScript, the logical NOT operator ! converts a value to its boolean equivalent and then negates it.

When you apply the first negation !null, the null value is coerced to a boolean. Since null is a falsy value, !null evaluates to true. Then, applying the second negation with another !, you negate true, resulting in false.

Thus, the final output of the expression !!null is false. This understanding aligns with the evaluation of its logical truthiness and the behavior of the NOT operator in JavaScript. Other choices do not accurately reflect the result of negating null twice.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy