遍历无名对象

时间:2019-03-29 17:22:24

标签: javascript

如何遍历匿名对象?我熟悉for ... in循环。我计划将其中一个放置在for循环中,以将所有这些信息打印到网页上;我知道还有其他方法可以做到这一点,但我想通过两个循环来实现。

let students = [
  {
    name: "Milla",
    track: "Fullstack JavaScript",
    achievements: 5,
    points: 50
  },
  {
    name: "Iris",
    track: "iOS Development",
    achievements: 7, 
    points: 70
  },
  {
    name: "Per",
    track: "Front End Development",
    achievements: 12,
    points: 120
  },
  {
    name: "Oystein",
    track: "Software Engineering",
    achievements: 9,
    points: 90
  },
  {
    name: "Bjorn",
    track: "Data Science",
    achievements: 22, 
    points: 220
  }
] ;

0 个答案:

没有答案