What is the most effective way to modify deep value in multidimensional array?
I have following json:
[
{"name":"Series 1","data":[
{"x":1506470700,"y":null},
{"x":1506499200,"y":null},
{"x":1506499500,"y":483981},
{"x":1506499800,"y":504588},
{"x":1506500100,"y":502926},
{"x":1506500400,"y":501161},
{"x":1506500700,"y":506453}]
},{"name":"Series 2","data":[
{"x":1506470700,"y":null},
{"x":1506499200,"y":null},
{"x":1506499500,"y":-490671},
{"x":1506499800,"y":-495593},
{"x":1506500100,"y":-512765},
{"x":1506500400,"y":-479475},
{"x":1506500700,"y":-531689}]
}
]
I'd like to multiply x values by 1000. I can process it using this code for example:
arrayFromJson.forEach((series) => {
series.data.forEach((dataSet) => {
dataSet.x *= 1000;
});
});
But I was wondering whether there isn't more effective/elegant way to do it.