Categorías
Citas ECMAScript

El objeto this en ECMAScript

Uno de los grandes misterios de ECMAScript desvelado 🙂

We said earlier that this is not an author-time binding but a runtime binding. It is contextual based on the conditions of the function’s invocation. this binding has nothing to do with where a function is declared, but has instead everything to do with the manner in which the function is called.

When a function is invoked, an activation record, otherwise known as an execution context, is created. This record contains information about where the function was called from (the call-stack), how the function was invoked, what parameters were passed, etc. One of the properties of this record is the this reference which will be used for the duration of that function’s execution.

You Don’t Know JS: this & Object Prototypes — Leslie Zhang

Y qué decir de los libros de la serie You don’t know JS: muy recomendables.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *