kaniosrn-j
6/1/2017 - 8:05 PM

Convert an array into object

Convert an array into object

const race = '100m Dash';
const winners = ['Hunter Gath', 'Singa Song', 'Imda Bos'];

let win = winners.map((winner, index) =>({
        name: winner,
        race: race,
        place: index++
}));
console.log(win);