119
rated 0 times
[
120]
[
1]
/ answers: 1 / hits: 51752
/ 12 Years ago, fri, september 21, 2012, 12:00:00
I want to update an object that could look like this:
currentObject = {
someValue : value,
myObject : {
attribute1 : foo,
attribute2 : bar
}
};
.. with an object that contains some changes i.e.:
updateObject = {
myObject : {
attribute2 : hello world
}
};
At the end I would like to have currentObject updated so that:
currentObject.myObject.attribute2 == hello world
That should be posible for other objects as well..
As a solution I thought about iterating over the object and somehow take care of the namespace. But I wonder if there is an easy solution for that problem by using a library like jQuery or prototype.
More From » object