[
{'id': 123, 'name': 'apples', 'total': 30},
{'id': 541, 'name': 'oranges', 'total': 42},
{'id': 300, 'name': 'bananas', 'total': 18}
]
How do I output this array in a form like that:
Apples: 30
Oranges: 42
Bananas: 18
I tried
let myArray = [{
'id': 123,
'name': 'apples',
'total': 30
},
{
'id': 541,
'name': 'oranges',
'total': 42
},
{
'id': 300,
'name': 'bananas',
'total': 18
}
]
console.log(JSON.stringify(myArray.map(a => a.name)))
but that's not exactly what I want.