I am trying to extend an object, and I want to modify a method of the first, not to override it. I don't think this is clear so here is an example:
var object1 = {
whatever : function(){
console.log('first object method');
}
}
var object2 = {
whatever : function(){
console.log('second object method');
}
}
var object = $.extend(true, object1, object2);
object.whatever();
This example will output second object method
, but what I want is that it ouput first object method
and second object method
.
Is there a way to do this?