I have following json array. I want to access the value of revenue
for all of them.
data = [
{"year": 2017, "revenue": 1000, "cost": 500},
{"year": 2016, "revenue": 1500, "cost": 900},
{"year": 2015, "revenue": 900, "cost": 300}
]
I can get data[0].revenue
. But it only give me access to one year. How can I access them all? I'm really new to javascript.