All unary operators
a unary operator is preceding (or following) its operand
WHEN the operator is before the operand
AND it is +
THEN a number-like string converts it to a number
AND it is -
THEN a number-like string converts it to the negated value of this number
AND it is ~
THEN a number-like string converts it to a number and return the bitwise complement
AND it is !
THEN a boolean-like string returns the negated boolean
AND it is delete
before an object's property THEN the property is removed
AND it is void
THEN it returns undefined
AND it is typeof
THEN it returns the operand's type
AND it is ++
THEN it increments the operand
AND it is a --
THEN it decrements the operand
WHEN the operator is after the operand
AND it is ++
THEN the operand is incremented
AND it is --
THEN the operand is decremented
Related Katas
Unary Operators
- All unary operators
- Unary "+" operator
- Unary "+" operator in depth
Bitwise Shift Operators
Rest operator
Spread operator
Difficulty Level
BEGINNER
First Published
7 February 2021
Stats
12 tests to solve