javascript functions.
Every function in javascript has:
- this (the current object on which it is using - if no object is used and the function is just called like that it uses window object as this)
- scope (all the variables that are defined with in the scope of this function and its parents are accessible via this scope).
- Functions have lexical scope, ie scope is defined when the function is defined. As soon as the function is called, this scope is used to assign the latest values to the variables used in the function. This is how closures work.
- this (the current object on which it is using - if no object is used and the function is just called like that it uses window object as this)
- scope (all the variables that are defined with in the scope of this function and its parents are accessible via this scope).
- Functions have lexical scope, ie scope is defined when the function is defined. As soon as the function is called, this scope is used to assign the latest values to the variables used in the function. This is how closures work.