Issue
Help to return a new array from the data from json.
At the output I want to get array of itog
[12860498,20156554,19187309]
[
{
"0": {
"itog": 12860498,
"return": 1107294,
"beznal": 10598131
},
"date": "2021-01-31"
},
{
"0": {
"itog": 20156554,
"return": 1147363,
"beznal": 18127393
},
"date": "2021-02-28"
},
{
"0": {
"itog": 19187309,
"return": 1667656,
"beznal": 17597434
},
"date": "2021-03-31"
}
]
Solution
const a = [
{
"0": {
"itog": 12860498,
"return": 1107294,
"beznal": 10598131
},
"date": "2021-01-31"
},
{
"0": {
"itog": 20156554,
"return": 1147363,
"beznal": 18127393
},
"date": "2021-02-28"
},
{
"0": {
"itog": 19187309,
"return": 1667656,
"beznal": 17597434
},
"date": "2021-03-31"
}
];
const result = a.map(function(i) {
return i[0].itog;
});
console.log( result );
Answered By – Hitesh Lala
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0