Friday, July 20, 2007

call() and apply() of Function methods

These methods allow you to invoke a function as if it were a method of some other object.

<script type="text/javascript" language="JavaScript">

function doc(str){
document.writeln("<br />");

var str = 'test';, str);

// This is similar to the following lines of code:
String.m = doc;
delete String.m;


No comments :