Remember that the typical functions in JavaScript functional programming nowadays, are: forEach, filter, map, reduce (the last one is the more powerful of all).
We also have others, like: Object.assign and Object.defineProperty.
I mentioned forEach because it is the simplest, not because it fit in the example.
Why use forEach() instead of map()? ForEach returns
undefinedso you can't display anything on the page when looping through the array.Remember that the typical functions in JavaScript functional programming nowadays, are:
forEach,filter,map,reduce(the last one is the more powerful of all).We also have others, like:
Object.assignandObject.defineProperty.I mentioned
forEachbecause it is the simplest, not because it fit in the example.Thank you.
Thank you for your input.