Hi, I'm doing some experiments with mochikit and everything seems to
work well.
It is a great library.
I have a question probably more related to javascript than mochikit.
I'm not sure what is the best method to create a "class" in javascript.
I have seen we can use 3 methods:
1)
function Person1() {
this.name = "Fabio";
}
Person1.prototype.sayName = function() {
alert("Hi, my name is " + this.name);
}
2)
Person2 = function() {};
Person2.prototype = {
name: "Paul",
sayName: function () {
alert("Hi, my name is " + this.name);
}
}
3)
function Person3(){
this.name = "Bill";
this.sayName = function(){
alert("Hi, my name is " + this.name)
};
return this;
}
I was used to use the first one and with the prototype for defining the
class methods,
but currently it seems to me that the third is more used. Why?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---