How to get value in single array not in nested array without any additional operation outside map function.
const List = []
List.push(
{
name: 'John',
id: 383,
Value: [
{
"Age": "10"
},
{
"Age": "20"
}
],
},
{
name: 'Mark',
id: 545,
Value: [
{
"Age": "30"
},
{
"Age": "40"
}
],
}
)
const ageList = List.map((list, index) => {
let age = [];
list.Value.map(item => {
age.push(item.Age)
})
return age
})
console.log(ageList)
Orignal Output : [ [ ’10’, ’20’ ], [ ’30’, ’40’ ] ]
Expected Output : [10,20,30,40]