I'm getting into actual object oriented programming using JavaScript and i've run into two different ways of extending the prototype of an existing object.
Method one:
Something.prototype.someFunc = function() {
// To something usefull
}
Method two (using underscore.js):
_.extend(Something.prototype, {
someFunc: function() {
// Do the same but differently
}
}
What is the difference between these two approaches? Which one is considered "better"? To me it looks like the first method is better because it uses plain old javascript, and the second method is someone elses implementation. But on the other hand, the underscore.js developers surely didn't add the _.extend() method for nothing?