Object Oriented JavaScript Tutorial

The apply() method takes two arguments.
The first one is the object to be used for this.
The second one is an array of arguments to be passed to the function.

function sayColor(sPrefix, sSuffix) {
    alert(sPrefix + this.color + sSuffix);
};
var obj = new Object();
obj.color = "red";
sayColor.apply(obj, new Array("The color is ",", a very nice color indeed."));