What exactly is the difference between undefined and void 0 ?
undefined
void 0
Which is preferred and why?
The difference is that some browsers allow you to overwrite the value of undefined. However, void anything always returns real undefined.
void anything
undefined = 1; console.log(!!undefined); //true console.log(!!void 0); //false
1.4m articles
1.4m replys
5 comments
57.0k users