I have an object and an array of the same object keys:
var obj = {
'fieldOne': {
'fieldTwo': {
'fieldThree': {
'fieldFour': {
'someNestedKey': 'test'
}
}
}
}
}
var keysArr = ['fieldOne', 'fieldTwo', 'fieldThree', 'fieldFour', 'someNestedKey'];
Is there a way to change the 'someNestedKey' value using the keys array ?
Simply accessing the 'someNestedKey' by indexes won't work, because keys array may have more or less keys in it. I tried somehow using array length, but I can't seem to get it working. I'm relatively new to programming, would much appreciate any help.