Adrenalin\’s Blog

iunie 12, 2006

Javascript Eval scope namespace execution context

Filed under: Javascript — Adrenalin @ 20:09

Here is a quote from ECMA-262:

Eval Code
When control enters an execution context for eval code, the previous active execution context, referred to as the calling context, is used to determine the scope chain, the variable object, and the this value. If there is no calling context, then initialising the scope chain, variable instantiation, and determination of the this value are performed just as for global code.

  • The scope chain is initialised to contain the same objects, in the same order, as the calling context’s
    scope chain. This includes objects added to the calling context’s scope chain by with statements and
    catch clauses.
  • Variable instantiation is performed using the calling context’s variable object and using empty
    property attributes.
  • The this value is the same as the this value of the calling context.

Also a example of code

function SomeFunc() {
  var a = ‘a local variable’;

A alert box will appear with ‘a local variable’ text.

Lasă un comentariu »

Niciun comentariu până acum.

RSS feed for comments on this post. TrackBack URI

Lasă un răspuns

Completează mai jos detaliile tale sau dă clic pe un icon pentru a te autentifica:


Comentezi folosind contul tău Dezautentificare /  Schimbă )

Fotografie Google

Comentezi folosind contul tău Google. Dezautentificare /  Schimbă )

Poză Twitter

Comentezi folosind contul tău Twitter. Dezautentificare /  Schimbă )

Fotografie Facebook

Comentezi folosind contul tău Facebook. Dezautentificare /  Schimbă )

Conectare la %s

Blog la

%d blogeri au apreciat: