Function
- PROPS arity, caller, constructor, length, name
- METHS apply, bind, call, isGenerator, toSource, toString
[call ]
- method of the function object,
[apply ]
- method of the function object, applies to arrary
this
EXAMPLE - 1 - this js
var person = new Person("john","doe");
console.log(this.first, this.last);
// returns john doe
EXAMPLE - 2 - this jquery
button.click
this refers to button
EXAMPLE - 3
this is not assigned a value until an object invokes the function where this is defined. Let’s call the function where this is defined the “this Function.”
Even though it appears this refers to the object where it is defined, it is not until an object invokes the this Function that this is actually assigned a value. And the value it is assigned is based exclusively on the object that invokes the this Function.
this has the value of the invoking object in most circumstances.
EXAMPLE The use of this in the global scope
window.showFullName()
VS
person.showFullName()
] When this is most misunderstood and becomes tricky
The this keyword is most misunderstood when ] we borrow a method that uses this, ] when we assign a method that uses this to a variable, ] when a function that uses this is passed as a callback function, and ] when this is used inside a closure—an inner function. We will look at each scenario and the solutions for maintaining the proper value of this in each example.