EDIT: To clarify: My question isn’t concerned with how void is used but whether void can be really useful. I’m asking this because the way people seem to use it is very offputting…
The MDN Reference for the void operator makes an example of the operator in use
<a href="javascript:void(0);">Click here to do nothing</a>
<a href="javascript:void(document.body.style.backgroundColor='green');">Click here for green background</a>
Not exactly the sort of way we handle click events nowadays.
Is there a place for void in this world? Can someone show me a good example of using void?
Jakob shows some practical use cases of
void. However as he mentionsvoidis not really required, but I use it to test forundefined. I use it to create my owntypeOffunction:You may read why I do so here.