the question is straight forward. Just like in PHP we have the magic function __construct()
, is there any related function or hack I can use in javascript?
Example:
function setLength() {
/* Some work */
}
var a = new Object();
b = new String("Hello");
//Is there anyway the function setLength() will automatically be fired when an Object or String... created?
I'm looking forward to your answers. Thank a lot for any help.
[x]