Vue traverses the substitution array

first of all, there is such a piece of data

list["zhangsan","lisi","wangmazi"]
people[
  {
    name: "zhangsan",
    username: ""
  },{
    name: "lisi",
    username: ""
  },{
    name: "wangmazi",
    username: ""
  }
]

then the question arises: how can all the data in list be replaced with the corresponding Chinese names in people ?


list = list.map(item => {
        people.forEach(ele => {
          if (item === ele.name) {
            item = ele.username
          }
        })
        return item
      })
Menu