If there is a Javascript object with multiple levels, as in:
myObject = { a: 12, obj11: { obj111: 'John', b:13, obj1111: { a:15, b: 35 } obj21: { a:15, b:16 } } I want to write a function to which is passed the object, an array of keys and the value to be assigned to the matched property.
function myFunc (myObj,myArr, newValue) { ... } myFunc(myObject, ['obj11', 'obj1111'], {z:12}); console.log(myObject.obj11.obj1111); Should display {z:12}. Assume that the keys in the array are always correct.
myArr.