What is VOID Operator - Daily JavaScript Tips #3

What is VOID Operator - Daily JavaScript Tips #3

ยท

1 min read

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

Live Demo


Thank you for reading

ย