Skip to main content

Command Palette

Search for a command to run...

What is VOID Operator - Daily JavaScript Tips #3

Published
•1 min read
What is VOID Operator - Daily JavaScript Tips #3
D

I am 17 years old and a young passionate and self-taught frontend web developer and have an intention to become a successful developer. I usually write about JavaScript and Web Development and share some tips in the articles.

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

More from this blog

D

Dhairya Shah

119 posts