i am trying to console log an array from the ticket master API but can only seem to log 1 item from the array

94 Views Asked by At

I am currently trying to get all event names to populate in my console log, but I can only get one to show. I understand why I am only showing 1 result(because I chose object 0 in the array), but I am unsure how to get them all to show

code below console.log("event:" + response._embedded.events[0].name);

pic of array

2

There are 2 best solutions below

1
Tim Ackroyd On BEST ANSWER

You could do something like:

console.table(response._embedded.events, ["name"])
0
Brandon Henry On

maybe this?

console.log("events: " + response._embedded.events.map(e => e.name));