简体   繁体   中英

Can't get data from fetched array

have a mongo database which holds a short list of events with some extra data. The data is returned and sent to the App. This all goes swimmingly. Inside the App I want to extract titles foreach array element, but when i try use or foreach loop the output is undefinded.

** data i get from api:** {status: 'ok', e.nets: Array(1)} e.nets: Array(1) 0 {title: 'r', descryption: 'asd', StartDate: '2022-12-16 13:51', EndDate: '2022-12-29 09:52', _id: '63944787606e1280f2e14cde'}

I tried:

foreach()

 data.events.forEach(element => {
Title = data.events.title
    
  });

I think the returned data from the API is e.nets not events

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM