2018-06-22 for...of

    for (let i = 0; i < favs.length; i++) {
      favs[i].listing = 
        Object.assign({}, favs[i].listing, {
        favoriteId: favs[i].id,
      })
    }   

for( ... of ...)

    for (const fav of favs) {
      fav.listing = Object.assign({}, fav.listing, {
        favoriteId: fav.id,
      })
    }

你可能感兴趣的:(2018-06-22 for...of)