What is the output of the expression !!null; !!''; !!1;?

Prepare for the Salesforce JavaScript Developer I Certification Exam. Utilize interactive quizzes, flashcards, and detailed explanations for each question. Boost your confidence and ace your exam effortlessly!

To evaluate the expression !!null; !!''; !!1;, let's break down each part of it using the concept of the double negation operator (!!) in JavaScript.

The first part, !!null, converts the value null to a boolean. In JavaScript, null is considered a falsy value, which means that when you apply the double negation, it converts null to false. So, the output of this part is false.

Next, for the second part, !!'', we apply the same logic. An empty string ('') is also a falsy value in JavaScript. Therefore, using double negation on an empty string will also yield false. Thus, the output here is again false.

Lastly, for the third part, !!1, we see that the number 1 is a truthy value in JavaScript. When we apply the double negation to 1, it converts it to true. Hence, the output here is true.

Putting all these results together, we obtain the final sequence of values: false for the first expression, false for the second, and true for the third. Therefore, the complete output is false, false, true, which corresponds correctly to the selected answer.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy