What is the difference between the scope of an object and its context in javascript?

In a folk language, region and context have much in common. That's why I get embarrassed when I read links to both, for example, in a quote from an article about closing:

The scope refers to where variables and functions are available, and in what context it is executed. ( @robertnyman )

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

Can someone explain what exactly context is , as used, for example, in jQuery syntax, $(selector, context) . And is the object the same scope in it?


Update:

I found this interesting article that talks about scope and context in JavaScript.

http://www.digital-web.com/articles/scope_in_javascript/

+7
javascript scope jquery definition
source share
2 answers

The "context" used in this jQuery example is not a JavaScript term. This is simply the name of the variable. It is documented along with the rest of the jQuery documentation: http://api.jquery.com/jQuery/#selector-context

+5
source share

"context" can mean many things. In the jQuery example, you indicate that this is a reference to the part of the DOM to which the selector should apply, which has nothing to do with JavaScript contexts.

+1
source share

All Articles