Menu
Hi,
I’m always confused about the following way of modifying prototype. Are they the same? Or they slightly different? When to use one vs the other? Thanks!
[CODE]
var Mammal = function (name) {
this.name = name;
};
//first way
Mammal.prototype.get_name = function ( ) {
return this.name;
};
//second way
Mammal.prototype={
get_name: function ( ) {
return this.name;
}
};