Sometimes we want to use an object's method on a different object. Such a thing is possible in Javascript through the usage of the call() method.

Let's take the Array.prototype.slice method as an example, which returns a new array object from a portion of an existing one. This method can be used to transform array like objects such as arguments or NodeList into real arrays.

If we call [1,2,3].slice(), the [1,2,3] array is set as the value of this in the call to slice(), which then does it's thing.

We can not call slice on an arguments object, as it is obviously not an Array. It is similar to an Array, but does not have any Array properties, except for length.

But it does look enough like an Array for slice() to work properly, all we need to do is to change the value of this in the call to slice:

// Using the Array prototype
var args1 =;

// Using an Array object
var args2 = [];

// Do array stuff

args1.forEach(function(item) {  
}); {  
   return item.toUpperCase();

So this is what happens when you set an arguments object as the this value when calling slice(). Because arguments has a length property and a bunch of numeric indices, slice() just does its work as if it was working on a real Array.