O'Reilly logo
  • Gail Smith thinks this is interesting:

Within editName, the map function is used to create a new array of objects based upon the original array. Array.map injects the index of each item into the callback as the second argument, the variable i. When i is not equal to the index of the item we wish to edit, we’ll simply package the same item into the new array.  When i is equal to the index of the item that we wish to edit, we replace the item at that index in the new array with a new object.

From

Cover of Learning React

Note

this makes no sense at all, what variable "i" are you talking about.