Mega Code Archive

 
Categories / JavaScript Tutorial / Function
 

Function call()

Syntax function.call(this)     function.call(this, arg1, arg2, ..., argN) The call() method can call another object's method. Optional arguments can be passed to the method as shown in the second syntactical definition. <html>     <script language="JavaScript1.3">     <!--     function person (author, name){       this.name = name;       this.author = true;     }     function authors(name, books){       this.books = books;       person.call(this, name);     }     authors.prototype = new person();     var myAuthor = new authors("Allen", 5);     -->     </script> </html>