If you're not in the global scope, you still have to do a lookup for a local undefined
variable (which could be 1
, null
, 'fjakfjadjfjlfjsdkj'
, or any other random thing), since undefined
is not a reserved word. Otherwise though, a browser that supports ES5 could do so in theory, as the global undefined
variable could never be changed.
Does comparison to 'undefined` still does a global scope lookup?
-
01-07-2022 - |
Question
Accordigng to http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.1.3 undefined
can't no longer be redefined.
Does it imply that global lookup (to find if undefined
was redefined) is not happening anymore?
Though, it does seem to be unnecessary now :)
UPDATE
Of course the question is about the strict
mode :) Thanks T.J.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow