-
-
Save Ajnasz/1074795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var a = ['lorem', 'ipsum', 'dolor']; | |
var repeat = true; | |
var i = 0; | |
var f = function () { | |
console.log(a[i]); | |
var finished = i + 1 >= a.length; | |
if (!finished || repeat) { | |
i = finished && repeat ? 0 : i + 1; | |
setTimeout(f, 1000); | |
} | |
}; | |
f(); | |
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var repeat = true; | |
var i = 0; | |
var f = function () { | |
console.log(i + 1); | |
var finished = i + 1 >= 10; | |
if (!finished || repeat) { | |
i = finished && repeat ? 0 : i + 1; | |
setTimeout(f, 1000); | |
} | |
}; | |
f(); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment