Wednesday, October 22, 2014

Jquery extend function

This is somehow good when extend data and overwrite

var object1 = {
apple: 0,
banana: { weight: 52, price: 100 },
cherry: 97
};
var object2 = {
banana: { price: 200 },
durian: 100
};
// Merge object2 into object1
$.extend( object1, object2 ); object1 data {"apple":0,"banana":{"price":200},"cherry":97,"durian":100}

No comments:

Post a Comment