Skip to content

Instantly share code, notes, and snippets.

@colibie
Created April 19, 2020 14:09
Show Gist options
  • Save colibie/6bfcbc46a1009070fd78d13de3a82927 to your computer and use it in GitHub Desktop.
Save colibie/6bfcbc46a1009070fd78d13de3a82927 to your computer and use it in GitHub Desktop.
A basic recursive function
function hello(i) {
if (i < 0) return; // base case
console.log(i);
hello(--i); // recursive call
}
hello(5) // output: 5 4 3 2 1 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment