What is the difference between .map, .every, and .forEach?

前端 未结 4 1365
遥遥无期
遥遥无期 2020-12-04 05:26

I\'ve always wondered what the difference between them were. They all seem to do the same thing...

4条回答
  •  攒了一身酷
    2020-12-04 05:41

    For Ramda, the difference between R.map() and R.forEach() is:

    1. R.forEach() returns the original array whereas R.map() returns a functor
    2. R.forEach() can only operate on array but R.map() can also operate on an object (i.e. the key/value pairs of the object are treated like an array)

提交回复
热议问题