3 ms·
"undefined" (and "NaN") are not a reserved keywords. They're just a properties of global object, with values of, respectively, primitive "undefined" and primiti
by seba_dos1 11y ago
"undefined" (and "NaN") are not a reserved keywords. They're just a properties of global object, with values of, respectively, primitive "undefined" and primitive "NaN" (which are not accessible directly).
In ES5 these properties are defined as [[Writable]]: false, which explains your behaviour.
You can however still create such variable in non-global scope - simply wrap that code in a function and it will work.