The call method in JavaScript

Hey all,

I’m confused as to why the call method is being used here. We call it on slice, which itself is a method of Array. And we pass in, not an object, but a bunch of arguments stored in arguments. So it’s not like we are trying to use “this” for something else. We are just dealing with arguments passed into the constructor. So why is call used here? Why couldn’t we just use Array.prototype.slice(arguments)?

function Core(){
	var args =


Thanks for response

The arguments variable is an array-like object. By passing arguments to the array’s slice method, that slice method gives you a real true array.

Effectively, you’re converting an array-like object in to a proper array.

But why is the call method here necessary?

Thanks for response.

function Core(){
    console.log(typeof arguments);//Object
    console.log(arguments instanceof Array);//false
    var args = arguments.slice(0); //arguments.slice is not a function

understood, thanks.