Skip to content

Instantly share code, notes, and snippets.

@tomodutch
Last active August 29, 2015 14:25
Show Gist options
  • Save tomodutch/4757bc19548db7a88195 to your computer and use it in GitHub Desktop.
Save tomodutch/4757bc19548db7a88195 to your computer and use it in GitHub Desktop.
A simple demonstration of recursion
function addOne(number, times, iterated) {
iterated = iterated || 0;
return iterated == times ? number : addOne(number + 1, times, iterated + 1);
}
addOne(1, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment