How would you abuse reduce()?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
The main value of “map” is to denote a 1:1 data transformation. Plus this gets very fraught with many langages mapping lazily, and some not guaranteeing the order of operation.
const idNameMap = itemList.reduce(toIdNameMap)
It should be intuitive that itemList is a list of objects familiar to the context of the code, and the result will be like: [{"id1":"Billy"}, etc.…But how?!
I can't see how anyone could build an intuition for this opaque line and the example of its apparent result. It's confusing enough that `idNameMap` actually refers to a list (or array), and not a map (or object).