Question: Javascript ES6 1. Use the .map() method on the heros array to return a new array. (5 pts) The new array should rename the 'name'
Javascript ES6

1. Use the .map() method on the heros array to return a new array. (5 pts) The new array should rename the 'name' key to 'hero' The 'name' key should not appear in the new array The new array should have a new key added called (id) The key 'id' should be based off the index const heros = [. { name: 'Spider-Man' }, { name: 'Thor' }, { name: 'Black Panther' }, { name: 'Captain Marvel' }, { name: 'Silver Surfer' } 1: EXPECTED OUTPUT (array of objects): { id: 0, hero: 'Spider-Man' }, { id: 1, hero: 'Thor' }, { id: 2, hero: 'Black Panther' }, { id: 3, hero: 'Captain Marvel' }, { id: 4, hero: 'Silver Surfer' }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
