如何显示数组的列表元素?
How do I show a of list elements of an array?
我有一个包含 465 个项目的大型数组,每个项目有五个元素。例如
const fixture = {id: '955dc591ce70', title: 'Liverpool vs Arsenal', date: '2022-03-18', start: '2022-03-18T19:35:00', end: '2022-03-18T21:05:00', competition: 'Premier League'}
我想为每场比赛输出一组比赛。我试过 console.log(this.state.fixtures.competition)
但没有成功。我怎样才能做到这一点?
试试这个输出到控制台
this.state.fixtures.forEach(fixture => console.log(fixture.competition));
我有一个包含 465 个项目的大型数组,每个项目有五个元素。例如
const fixture = {id: '955dc591ce70', title: 'Liverpool vs Arsenal', date: '2022-03-18', start: '2022-03-18T19:35:00', end: '2022-03-18T21:05:00', competition: 'Premier League'}
我想为每场比赛输出一组比赛。我试过 console.log(this.state.fixtures.competition)
但没有成功。我怎样才能做到这一点?
试试这个输出到控制台
this.state.fixtures.forEach(fixture => console.log(fixture.competition));