Skip to content

Instantly share code, notes, and snippets.

@vstarck
Created August 30, 2011 17:59
Show Gist options
  • Save vstarck/1181536 to your computer and use it in GitHub Desktop.
Save vstarck/1181536 to your computer and use it in GitHub Desktop.
gejs5.3_2.js
function loop(from, to, handler) {
(function cycle(n) {
[
eval,
function(n) {
handler(n);
cycle(n+1)
}
][1^(n/to)](n)
})(from);
}
loop(50, 100, console.log);
// one liner
function l(f,t,h){(function c(n){[eval,function(n){h(n);c(n+1)}][1^(n/t)](n)})(f);}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment