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.
Remember you can, in most of the cases, simply do:
This way, you only need to avoid
undefined
ornull
values.Why use forEach() instead of map()? ForEach returns
undefined
so 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.assign
andObject.defineProperty
.I mentioned
forEach
because it is the simplest, not because it fit in the example.Thank you.
Thank you for your input.