Because I'm dealing with a relatively big object, I want to be able to modify my object value dynamically by defining a "path".
let a="x", b="y", c="z"
let objKeys = [a, b, c]
let value = 5
obj = {x:
{y:
{z: 1
}
}
}
I want to be able to achieve this.
obj[a][b][c] = value;
Is there any way to do this? I tried obj(eval(`["a"]["b"]["c"]`)) = value but it says that "invalid left-hand side in assignment".
{key:value}. What you have shown in that example is a list represented as an Array. That is part of the reason your question is unclear. Please try to edit your question so we can understand your intent.