Loading lesson path
Concept visual
Start at both ends
Function Object Methods & Properties
Calls a function with a specified this value and an array of arguments bind() Returns a function with a specified this value call() Calls a function with a specified this value and individual arguments length Returns the number of (expected) parameters of a function name
Returns a string representation of the function's source.
? In JavaScript, the this keyword refers to an object. The this keyword refers to different objects depending on how it is used:
Alone, this refers to the global object.
In a function, this refers to the global object.In a function, in strict mode, this is undefined. In an object method, this refers to the object. In an event, this refers to the element that received the event. In methods like call(), apply() and bind(), this can refer to any object. this is not a variable. this is a keyword. You cannot change the value of this.
Use the following precedence of order to determine which object this refers to:
bind() this is in a function being called using bind()
apply() this is in a function being called using apply()
call() this is in a function being called using call()
Object method this is in an object function (method)
Global scope this is in a function in the global scope this
Use the following precedence of order to determine which object this refers to:
bind() this is in a function being called using bind()
apply() this is in a function being called using apply()
call() this in is a function being called using call()
Object method this in is an object function (method)
Global scope this in isa function in the global scope