Last updated 2 years ago
JS ⟩ statement ⟩ expression ⟩ operator ⟩ arithmetic ⟩ 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
cannot convert Symbol to Number❗️
cannot convert BigInt to Number❗️
unary plus (+), 🚧
unary minus (-),
increment (++),
decrement (--)
JavaScript: The Definitive Guide ⟩ 4.8.2 Unary Arithmetic Operators