Whats the difference between the following two bits of code:
[AS]
Dog = function( )
{
this.legs = 4;
}
rover = new Dog( );
fido = new Dog( );
yeller = new Dog( );
[/AS]
AND
[AS]
Dog = function( ){}
Dog.prototype.legs = 4;
rover = new Dog( );
fido = new Dog( );
yeller = new Dog( );
[/AS]
Is one better than the other? If so, how?
Can’t get my head around it!?
Viru.