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
Thank you for reading
- Follow me on Twitter - @codewithsnowbit
- Subscribe me on YouTube - Code With SnowBit
Top comments (0)