LoginSignup
1
0

More than 5 years have passed since last update.

JSで1〜nまでの整数配列を作成する

Posted at

ES2015シンタックス+ES5ビルトインでがんばる

Array(...Array(10)).map((_,i)=>i+1)
// => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

緩募

ES2015以降のビルトイン使えばもっと短く書けそう。ステキな書き方知っている方、教えてください(コメント欄あたりに) :bow:

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0