Flashcards
this

Flashcards do conjunto (10)
- 1What does ‘this’ keyword mean?"This" refers to the object on which function(method) is called, so this is defined by the execution context. "This" doesn’t always refer to the same object in all cases, but instead the value you get with help of “this” depends on how function is called.
this is a runtime binding which means the object that this refers to changes every time the execution context is changed.
// this keyword is available in any function and points to the object that contains this function. - 2what could affect the value of ‘this’ keywordThe value “this” refers to is affected by strict mode and can also be changed manually (via bind()).
- 3Context/ Execution contextWhen a function is invoked, an activation record, else known as execution context, is created.
This record contains current evaluation state of code, information about the function, such as where the function was called from (the call-stack), how the function was invoked, what parameters were passed, refference to all environments that belong to given context, etc. One of the properties of this record is the reference tothis, which is used at the execution stage of the function.
Managed behind scenes by JS engine.
Can have more than 1 environment per context. When script executes can have multiple contexts. - 4EnvironmentIs inside a context, stores information about variables that belong to that env and also to any other env that might be part of this env. Part of the env is your scope.
- 5ScopeScope is a concept, it explains which var you can use where and that in the end depends on the environment you are running in.
- 6When new context is createdNew context is created when execute function.
- 7What 'this' depends onThis doesn’t depend on the environment but on context the environment is part of
- 8this in strict modeIn strict mode outside function - window, inside -undefined.
This does no longer assume the same value as it would have outside, so we simply change the value, the context of that function execution assigns to this,that is what changed in strict mode. - 9this in global context//In global context this inside and outside function refers to window object.
In the global execution context which means outside of any function, this refers to the global object whether in strict mode or not.
In browser global object-window - 10global context, window

Informações
- Descrição
- this FlashCards sobre this, criado por milly larcen em 14-04-2020.
- Criado por
- milly larcen
- Visualizações
- 0
- Avaliação