Pages

mercredi 13 juin 2012

JavaScript Constructors ( OOP )

in javascript a constructor is any function which is used as a constructor. The language doesn't make a distinction. A function can be written to be used as a constructor or to be called as a normal function, or to be used either way.


var Vehicle = function Vehicle() {  ....  }
var obj = new Vehicle();