LoginSignup
0
0

More than 5 years have passed since last update.

手元に配列がないけどmapを使いたい時

Last updated at Posted at 2017-11-07

こう書けばいいみたい。なるほどね。(for使えの突っ込みはなしで:wave:

Array.apply(null, { length: 3 }).map(function (elm, index) {
    console.log('出力', elm, index)
})

// 出力 undefined 0
// 出力 undefined 1
// 出力 undefined 2
0
0
3

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
0
0