The Call() Method : Inheritance : Object Oriented JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Object Oriented » Inheritance »

 

The Call() Method








The first argument of the Call() Method is the object to be used for 'this'.

All other arguments are passed directly to the function itself.








function sayColor(sPrefix, sSuffix) {
    alert(sPrefix + this.color + sSuffix);
};

var obj = new Object();
obj.color = "red";

sayColor.call(obj, "The color is "", a very nice color indeed. ");







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Object Oriented
» Inheritance