Standard built-ins
Function.prototype.apply()
Calls a function with an explicit this and an array-like list of arguments. A nullish list supplies no arguments; a non-object non-nullish list is invalid.
Formal Syntax & Structure
javascript syntaxjavascript
fn.apply(thisArg, [argsArray])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| thisArg | Any | Receiver supplied to target; the target controls this handling. |
| argsArray | Object | null | undefined | Array-like list or nullish empty list. |
Return Value
Any
Target return value.
Working Example
Example Snippetjavascript
function f(a,b){return this.n+a+b;}console.log(f.apply({n:1},{0:2,1:3,length:2}));