InterviewHubPRO
Section Overview
Q365

Question 365 of 521

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

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

What is the output of prepend additive operator on falsy values

If you prepend the additive(+) operator on falsy values(null, undefined, NaN, false, ""), the falsy value converts to a number value zero. Let's display them on browser console as below,

javascript
  console.log(+null); // 0
  console.log(+undefined); // NaN
  console.log(+false); // 0
  console.log(+NaN); // NaN
  console.log(+""); // 0