Javascript-This Flashcards
What is this in JavaScript?
this is an implicit parameter of all JavaScript functions.
What does it mean to say that this is an “implicit parameter”?
it is available in a function’s code block even though it was never included in the function’s parameter list or declared with var
When is the value of this determined in a function; call time or definition time?
the value of this is determined when the function is called,
How can you tell what the value of this will be for a particular function or method definition?
Find where the function is called and look for an object to the left of the dot. If you can’t see where the function (or method) is called, then you cannot say for sure what the value of this is.
How can you tell what the value of this is for a particular function or method call?
Find where the function is called and look for an object to the left of the dot.