unary arithmetic operator

JSstatementexpressionoperatorarithmetic ⟩ unary

unary plus (+), unary minus (-), increment (++), decrement (--)

🌟 table of operators

convert any value (except Symbol, BigInt) to Number.

// any -> number (except Symbol, BigInt)
+x

+Symbol()   // ⛔️ TypeError
+40n        // ⛔️ TypeError
// TypeError: Cannot convert a Symbol/BigInt value to a number

Last updated