the code below is an object from database
{
"id_": "1",
"name": "Enemy x",
"image": "image.png",
"stats": {
"level": 1,
"attack": 5,
"defense": 0
}
}
And need edit attack or defense, but with a "pointer" saved in a constant, All this in a dynamic way since the value to edit could be in a third or fourth level of the object. for example:
const edit = 'stats/attack';
// const edit = 'stats/other/example'; <- example
I have some ideas but I don't know if exist best practices for this, or how to look for it on the internet since I can't find anything like it.