Searching the Void in Javascript
What is void and does it have a role in modern Javascript? The unary void operator is rather strange and has quirky use cases. Or, should I say ‘had quirky use cases’. Primarily, void was used to check the true undefined. Consider the below code - undefined = 0; console.log("undefined: ", undefined); The above code would return 0 instead of undefined a couple of years back. So, we did this instead - let planet; //.. a lot of code .. planet = void 0; console.log("planet: ", planet); // undefined void was a sure way to find the true undefined. ...