What is the output of: console.log(+’3′, +true, +null, +undefined)?

JavaScript Developer Medium

JavaScript Developer — Medium

What is the output of: console.log(+’3′, +true, +null, +undefined)?

Key points

  • The unary plus operator converts non-number values to numbers
  • '3' is converted to 3, true is converted to 1, null is converted to 0
  • Undefined cannot be converted to a number, resulting in NaN

Ready to go further?

Related questions