Mapping Numbers with Their Indices
Use the
To solve this, use the second parameter of the
map method on nums to create a new array. Each element in the new array should be the original number plus its index. Store the final array in a variable called result.To solve this, use the second parameter of the
map callback, which gives you the current index.Premium
JavaScript
Console