Created
March 6, 2020 05:28
-
-
Save aclave1/9670b93d7981d94df1ad11accc3bf69a to your computer and use it in GitHub Desktop.
recursion example for a friend
This file contains hidden or 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
// example 1 | |
x(); | |
function x() { | |
console.log('hello!') | |
x(); | |
} | |
//example 2 | |
print_multiple_times(10) | |
function print_multiple_times(remaining) { | |
if (remaining=== 0) { | |
console.log('done') | |
return; | |
} | |
console.log('hello!') | |
print_multiple_times(remaining - 1) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment