there is an object
var obj = {
a: {
b: {
c: 3
}
}
};
var text = "a.b.c"
how to modify the value of c
according to text
path to 4
, so that the result is
{
a: {
b: {
c: 4
}
}
}
Mini Program"s setData
method supports data path input. I just want to know how to implement this function. The known idea is recursion
let text = "a.b.c";
this.setData({
[text]: 4
})
Thank you for your help