A small question for versed javascript programmers: There are two ways to declare a function in javascript.
A: javascript-object-notation
function MyLittleHouseA(name) {
this.age = 88,
this.name = name,
this.getName = function()
{
return this.name;
}
}
B: uhm, normal:
function MyLittleHouseB(name) {
this.age = 88;
this.name = name;
//do some more proceduaral stuff upon 'construction'
this.age = this.age + 20;
this.getName = function()
{
return this.name;
}
}
I find A more elegant (and have a number of objects I want to turn into configurable options...), but might want to do some more stuff upon instance creation, hence I do need as shown in B.
Can these be mixed?
¡ Thanx !