What is the difference between an object's scope and it's context in javascript?

Posted by DKinzer on Stack Overflow See other posts from Stack Overflow or by DKinzer
Published on 2010-04-25T18:35:58Z Indexed on 2010/04/25 18:43 UTC
Read the original article Hit count: 190

Filed under:
|
|
|
|

In the vernacular, scope and context have a lot in common. Which is why I get confused when I read references to both, such as in the quote below from an article on closures:

Scope refers to where variables and functions are accessible, and in what context it is being executed. (@robertnyman)

As far as I can tell, context is just a reference to an object.

Can someone please explain what exactly is context, as used, for instance, in the jQuery syntax, $(selector, context). And is an object's scope the same at it's context?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery