I have below array object -
[
{
index:0,
value:"Yes",
},
{
index:1,
value:"No",
},
{
index:2,
value:"No",
},
{
index:3,
value:"Yes",
},
]
I want to update value of each element in array with "NA"
I tried doing -
obj.map(x=>{
x.value="NA"
});
This is not working.
mapcallback. Tryreturn x;after you've set the value. Note:mapreturns a new array. You may wantforEachwhich can mutate the array instead - depends on your use-case.