エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
Is there a mechanism to loop x times in ES6 (ECMAScript 6) without mutable variables?
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Is there a mechanism to loop x times in ES6 (ECMAScript 6) without mutable variables?
The typical way to loop x times in JavaScript is: for (var i = 0; i < x; i++) doStuff(i); But I d... The typical way to loop x times in JavaScript is: for (var i = 0; i < x; i++) doStuff(i); But I don't want to use the ++ operator or have any mutable variables at all. So is there a way, in ES6, to loop x times another way? I love Ruby's mechanism: x.times do |i| do_stuff(i) end Anything similar in JavaScript/ES6? I could kind of cheat and make my own generator: function* times(x) { for (var i = 0

