Prev: Native Objects .prototype extending
Next: The 3rd way
From: Dmitry A. Soshnikov on 29 Nov 2009 07:14 On Nov 29, 4:10 am, Asen Bozhilov <asen.bozhi...(a)gmail.com> wrote: [...] > > `eval' defined properties of VO runtime too. > And, btw, forgot - although `eval` affecting on VO/AO of calling context at runtime, if to analyze exactly execution _context_ stuff, `eval` code also creates its own context inheriting from calling context needed things such as VO/AO, `this` value and scope chain. But still variable instantiation regarding to the `eval` context itself is also takes place, which means again - `var`s will be created on entering the context and _always_ initialize with `undefined` value: function test() { alert(a); // ReferenceError, "a" is not defined eval('alert(a); var a = 10; alert(a);'); // undefined, 10 } So regardless the calling context from which point of view it's a runtime, the `eval`'s context has two stages also - entering the context and runtime from which point of view `var` - is `var`, except that variable instantiation has empty attributes for the properties of VO/AO - for both: `FD`s and `var`s. /ds |