2009-10-11

Javascript object functions runs on creation

Consider the code bellow:

function myfunction(){
document.write("I was executed.");
}
var f = new myfunction();

The function myfunction is used as a class for the object f, and is also executed at creation time.

The code produces this result:

Niciun comentariu: