What are the functional differences between the following two Javascript prototypes, and are there any benefits for choosing one over the other?
Option 1:
Person.prototype.sayName = function(name) {
alert(name);
}
Option 2:
Person.prototype = {
sayName: function(name) {
alert(name);
}
}
Am I correct in assuming that Option 2 results in trashing certain functions that are implicitly bound to the prototype?