Function.prototype.apply()
Function.prototype.apply() is a JavaScript method in the Function category. Calls a function with a given this value and args as an array. The syntax is func.apply(thisArg, argsArray). A typical example: greet.apply(obj, ["Hello"]). A close sibling is Function.prototype.call(), which calls a function with a given this value and individual args. A close sibling is Function.prototype.bind(), which creates a new function with a bound this. A close sibling is Function.prototype.toString(), which returns the source code of the function. A close sibling is Function.length, which returns the number of formal parameters. More about this category: Function methods — call, apply, bind, and more. Related Function methods: Function.prototype.call(), Function.prototype.bind(), Function.prototype.toString(), Function.length, Function.name, Function.prototype[Symbol.hasInstance](), Function.prototype.constructor. This page is part of the free JS Reference documentation covering 1027+ methods, each with syntax, parameters, return values, examples, and common pitfalls. You can try Function.prototype.apply() immediately in the JavaScript playground, look up unfamiliar terms in the glossary, or return to the JS Reference homepage.