Skip to main content
added 81 characters in body
Source Link
JacquesB
  • 61k
  • 21
  • 133
  • 187

A scopeThere is the set ofno common term identifier bindings that(and you have access todon't need one) since they are different categories of things. The quote uses imprecise language:

In JavaScript, scope is the set of variables, objects, and functions you have access to.

I don't think thereTechnically this is a common name for functions, variableswrong, since it confuses variables and objectsvalues, because theywhich are somewhat differentdistinct concepts. Functions areA scope is a kind of object and object are are kindset of value, but variables are "slots" which may contain values. A variable is a named reference to a value. Objects, butfunctions and primitives are not values themselvesvalues.

  So there is a level of indirection between variablesvariable and values,value which mean you will rarely talk aboutcannot lump them as the same thingtogether.

A scope is the set of identifier bindings that you have access to.

I don't think there is a common name for functions, variables, and objects, because they are somewhat different concepts. Functions are a kind of object and object are are kind of value, but variables are "slots" which may contain values, but are not values themselves.

  So there is a level of indirection between variables and values, which mean you will rarely talk about them as the same thing.

There is no common term (and you don't need one) since they are different categories of things. The quote uses imprecise language:

In JavaScript, scope is the set of variables, objects, and functions you have access to.

Technically this is wrong, since it confuses variables and values, which are distinct concepts. A scope is a set of variables. A variable is a named reference to a value. Objects, functions and primitives are values. So there is a level of indirection between variable and value which mean you cannot lump them together.

Source Link
JacquesB
  • 61k
  • 21
  • 133
  • 187

A scope is the set of identifier bindings that you have access to.

I don't think there is a common name for functions, variables, and objects, because they are somewhat different concepts. Functions are a kind of object and object are are kind of value, but variables are "slots" which may contain values, but are not values themselves.

So there is a level of indirection between variables and values, which mean you will rarely talk about them as the same thing.