Skip to main content
InterviewHubPRO
Section Overview
Q354

Question 354 of 536

Part 6: Async Internals, Memory, Microtasks & Web APIs (329 - 403)

66%
JavaScript & V8 Internals (536 Qs)•Part 6: Async Internals, Memory, Microtasks & Web APIs (329 - 403)

What is the output of below console statement with unary operator

senior LevelCode ExampleAsync & PromisesEvent LoopHTTP & REST APIs

Let's take console statement with unary operator as given below,

javascript
  console.log(+"Hello"); // NaN

The output of the above console log statement returns NaN. Because the element is prefixed by the unary operator and the JavaScript interpreter will try to convert that element into a number type. Since the conversion fails, the value of the statement results in NaN value.