bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/JavaScript/Objects, Classes, and Advanced Patterns
JavaScript•Objects, Classes, and Advanced Patterns

JavaScript Function Reference

Concept visual

JavaScript Function Reference

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Function Object Methods & Properties

Revised December 2025

Name

Description apply()

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 the name of the function toString()

Returns a string representation of the function's source.

What is this

? 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.

This

Precedence

Use the following precedence of order to determine which object this refers to:

Order

Object

Because

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

Precedence

Use the following precedence of order to determine which object this refers to:

Order

Object

Because

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

Previous

JavaScript Temporal PlainTime

Next

JavaScript ZonedDateTime