LoginSignup
9
9

More than 5 years have passed since last update.

JavaScript で同じ要素が繰り返す配列を作る

Last updated at Posted at 2015-05-23

例えば 'AB' が10回繰り返すような配列を作る

Array.apply(null, Array(10)).map(function(){ return 'AB' });

結果

["AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB"]

イマイチだなーとは思う。

参考

9
9
9

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