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 encoded as
args = Array.prototype.slice.call(arguments)
will it be ok if i do
args = arguments.slice();
I'm just trying to figure out any specific reason for using call
And also what will be the other scenario where we will need to use Array.prototype.slice.call(arguments) ?
source share