LaVOZs

The World’s Largest Online Community for Developers

'; jquery - i am trying to console log an array from the ticket master API but can only seem to log 1 item from the array - LavOzs.Com

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

You could do something like:

console.table(response._embedded.events, ["name"])

maybe this?

console.log("events: " + response._embedded.events.map(e => e.name));
Related
How to get the jQuery $.ajax error response text?
How is $('h1') logging to the web console as an array in jQuery?
Difference between HTMLCollection, NodeLists, and arrays of objects
Can't access object property, even though it shows up in a console log
TypeError: $.ajax(…) is not a function?
console.log a javascript Object/Class - same result before and after the change of the prototype
Managing jQuery plugin dependency in webpack
Get only 1 object from array with 2 similar objects