Just learned about the void operator in #JavaScript


Just learned about the void operator in #JavaScript. Useful to say “return undefined, regardless of what this code does”.

Example:
return void res.status(200).json(user);

This code returns void, regardless of what the .json() call returns.

More on void: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void

View original on X