Skip to content

Instantly share code, notes, and snippets.

@dnasca
Created September 25, 2015 02:00
Show Gist options
  • Save dnasca/9689f0aecde0b1e9556e to your computer and use it in GitHub Desktop.
Save dnasca/9689f0aecde0b1e9556e to your computer and use it in GitHub Desktop.
es6 - the death of the while loop
//es5
function repeat(func) {
while (func() !== undefined) {
}
}
//es6 proper tail call
function repeat(func) {
if (func() !== undefined) {
return repeat(func);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment