Is there a way in Javascript to write something like this easily:
[1,2,3].times do {
something();
}
Any library that might support some similar syntax maybe?
Update: to clarify - I would like something()
to be called 1,2 and 3 times respectively for each array element iteration
Just use a loop:
var times = 10;
for(var i=0; i < times; i++){
doSomething();
}