Overview
suggest changeUnary operators take one operand. JavaScript does not let user code override them.
The following unary operators are available:
| Operator | Operation | Example |
|---|---|---|
| delete | Deletes a property from an object. It does not delete a variable. | delete obj.key |
| void | Evaluates its operand and yields undefined. |
void 0 |
| typeof | Returns a string naming the type of a value. typeof null is "object". |
typeof value |
| + | Converts its operand to a Number. | +"12" |
| - | Converts its operand to a Number, then negates it. | -n |
| ~ | Bitwise NOT after ToInt32. ~n is -(ToInt32(n) + 1). |
~3 |
| ! | Logical NOT. | !value |
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents