As seen in this SO question
Function.prototype.bind = function(){
var fn = this, args = Array.prototype.slice.call(arguments), object = args.shift();
return function(){
return fn.apply(object,
args.concat(Array.prototype.slice.call(arguments)));
};
};
In this example why is it coded as
args = Array.prototype.slice.call(arguments)
will it be ok if I do
args = arguments.slice();
I am just trying to understand any specific reason for using call
And also what would be some other scenario where we will have to use Array.prototype.slice.call(arguments) ?
arguments.slice()...?argumentsis an array!