I ran across some code that interrupts a function return void(0);
.
I believe that is being used to return undefined
but that can be done simply by writing return;
.
Does return void(0);
serve an additional purpose, or is this just two different ways to interrupt a function?
return void(0);
doesn't do anything special. It simply returns undefined
, albeit in a very silly way. It's probably a case of the original developer not understanding JavaScript fully.
It's just another way to return undefined
. See https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/void
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With