Array.prototype.mapintermediateconst letters = ['a', 'b', 'c']
letters.map((v, i) => i + ':' + v)
// β ['0:a', '1:b', '2:c']Use the index parameter of map() to include positional information in the transformed output.
The map callback optionally receives a second argument: the current element's index. This is useful for labelling, numbering, or interleaving positional data.
Challenge: Implement addIndex(arr) that prepends each element's index to its value.
addIndex(['a', 'b', 'c']) // β ['0: a', '1: b', '2: c']
addIndex([]) // β []