DEV Community

Cover image for What is VOID Operator - Daily JavaScript Tips #3
Dhairya Shah
Dhairya Shah

Posted on • Originally published at codewithsnowbit.hashnode.dev

What is VOID Operator - Daily JavaScript Tips #3

The void operator returns undefined value;
In simple words, the void operator specifies a function/expression to be executed without returning value

const userName = () => {
    return "John Doe";
}

console.log(userName())
// Output: "John Doe"

console.log(void userName())
// Output: undefined
Enter fullscreen mode Exit fullscreen mode

Live Demo


Thank you for reading

Top comments (0)