ES6 - generate an array of numbers

前端 未结 6 720
我寻月下人不归
我寻月下人不归 2021-01-31 08:03

Having googled for it I found two solutions:

6条回答
  •  死守一世寂寞
    2021-01-31 08:31

    Further refinement, produces an array with value starting from 1:

    Array.from(Array(10).keys(), n => n + 1)
    

提交回复
热议问题