Possible Duplicate:
What does “javascript:void(0)” mean?
What doesvoid 0mean?
In the file http://underscorejs.org/underscore.js, you can see such a code block:
// Is a given variable undefined?
_.isUndefined = function(obj) {
return obj === void 0;
};
I don’t understand the void 0 part, it’s very strange. How to understand it?
This is the console output
I think they are trying to save 3 bytes of file size 😉
Edit:
This SO answer makes more sense of using
void 0, asundefinedis just a property ofwindowobject and is mutable. Hencevoid 0is a trusted way to generate undefined across browsers