I'm wondering why is JavaScript's undefined created as object (W3Schools) and not defined as a keyword? And, are there any advantages to create custom undefined object (overwriting default undefined)?
For me, it's little bit confusing - as I've read, I should use
if(myObject === 'undefined')
{ /* ... */ }
although I often use incorrect version with === undefined). But this approach seems to me like I try to compare myObject with String though I'm trying to determine myObject state.
So, is it conceptual mistake or there was some valid reason to create it this way?
And last question: is using incorrect version potentially vulnerable? (by JS modification from browser or browser plugin)
Thanks for all responses.