0 votes
in JavaScript by
What's the output?
+true;
!'Lydia';
  • A: 1 and false
  • B: false and NaN
    • C: false and false

1 Answer

0 votes
by

Answer: A

The unary plus tries to convert an operand to a number. true is 1, and false is 0.

The string 'Lydia' is a truthy value. What we're actually asking, is "is this truthy value falsy?". This returns false.


...