Hi:
I am using prototype1.4 now.
When create new class using prototype ,people used to use this manner:
var Person = Class.create();
Person.prototype = {
initialize: function(name) {
this.name = name;
}
printName: function() {
alert(this.name);
}
}
However I can not see the advantage of this manner,since it is very readable
when use the native javascript:
function Person(name) {
this.name = name;
}
Person.prototype = {
printName: function() {
alert(this.name);
}
}
Anyone can tell me why?
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.