Salesforce JavaScript Developer Practice Exam 2025 – 400 Free Practice Questions to Pass the Exam

Question: 1 / 400

Given the expression +true; !'Lydia'; what will be the outputs?

1 and false

To evaluate the provided expression, let's break it down step by step.

Firstly, the expression uses the unary plus operator (`+`) with the boolean value `true`. The unary plus operator converts the operand to a number. In JavaScript, `true` evaluates to `1` when converted to a number. Therefore, the first part of the expression, `+true`, outputs `1`.

Next, the expression includes the negation operator (`!`) applied to the string `'Lydia'`. In JavaScript, when a non-empty string is evaluated in a boolean context, it is considered `truthy`. Applying the negation operator to a truthy value (`'Lydia'`) will give `false`. Thus, `!'Lydia'` outputs `false`.

Putting both outputs together, the expression `+true; !'Lydia';` results in the outputs `1` for the first part and `false` for the second.

The correct answer aligns with this rationale, as it correctly summarizes the outputs of the expressions evaluated.

Get further explanation with Examzify DeepDiveBeta

false and NaN

false and false

true and false

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy