/ Published in: JavaScript
*Requires JavaScript 1.8*
fn.call and fn.apply are alternative methods to access function.call and function.apply and I don't see fn.call and fn.apply having any use but I made them for the heck of it.
Syntax:
`fn.call(function, [thisObject, [argument1, ..., argumentN]])` is equivalent to `function.call(thisObject, argument1, ..., argumentN)`
`fn.apply(function, [thisObject, [argumentsArray]])` is equivalent to `function.apply(thisObject, argumentsArray)`
Examples:
function foo(a, b) (this*a)-b;
fn.call(foo, 5, 6, 7) == 23
foo.call(5, 6, 7) == 23
fn.apply(foo, 5, [6, 7]) == 23
foo.apply(5, [6, 7]) == 23
fn.call and fn.apply are alternative methods to access function.call and function.apply and I don't see fn.call and fn.apply having any use but I made them for the heck of it.
Syntax:
`fn.call(function, [thisObject, [argument1, ..., argumentN]])` is equivalent to `function.call(thisObject, argument1, ..., argumentN)`
`fn.apply(function, [thisObject, [argumentsArray]])` is equivalent to `function.apply(thisObject, argumentsArray)`
Examples:
function foo(a, b) (this*a)-b;
fn.call(foo, 5, 6, 7) == 23
foo.call(5, 6, 7) == 23
fn.apply(foo, 5, [6, 7]) == 23
foo.apply(5, [6, 7]) == 23