I ran into the following problem: I can combine / expand objects and work very well, but now I need to do the reverse side of the object extension, jQuery doc:
var object1 = {
apple: 0,
banana: { weight: 52, price: 100 },
cherry: 97
};
var object2 = {
banana: { price: 200 },
durian: 100
};
$.extend( true, object1, object2 );
{"apple":0,"banana":{"weight":52,"price":200},"cherry":97,"durian":100}
Which is cool, and it works great, but how do I get the opposite operation, for example, to get this output:
{"apple":0,"banana":{"weight":52},"cherry":97}
source
share