Why should forEach be preferred over regular iterators?

后端 未结 6 636
北荒
北荒 2020-12-01 18:22

I was reading airbnb javascript guide. There is a particular statement, that says:

Don’t use iterators. Prefer JavaScript’s higher-order functions ins

6条回答
  •  醉梦人生
    2020-12-01 19:23

    see the Performance of foreach and forloop here

    only for readablity we are using foreach. Other than that for loop is prefered for browser compatibality ,performance and native feel.

提交回复
热议问题