Unary Operators: All unary operators
unary - an operation with only one operand
Donate to NGO Julenka. Support Ukranians in need.
Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.
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