void Operator
The void operator evaluates the given expression and then returns undefined.
Syntax:
void expression
void( expression )
Example: In this example, we are using the void operator.
Javascript
function myFunction() { return void 0; } console.log(myFunction()); |
undefined
JavaScript Unary Operators
JavaScript Unary Operators work on a single operand and perform various operations, like incrementing/decrementing, evaluating data type, negation of a value, etc.
Table of Content
- Unary Plus (+) Operator
- Unary Minus (-) Operator
- Unary Increment (++) Operator
- Unary Decrement (–) Operator
- Logical NOT (!) Operator
- Bitwise NOT (~) Operator
- typeof Operator
- delete Operator
- void Operator
We will explore all the above operators along with their basic implementation with the help of examples.