reorganizing some more

This commit is contained in:
brightboost
2021-12-01 14:39:18 +01:00
parent f8bde27fc6
commit 9116b55477
37 changed files with 998 additions and 679 deletions
+35
View File
@@ -0,0 +1,35 @@
function getRecursive(nr) {
console.log(nr);
getRecursive(--nr);
}
getRecursive(3);
function logRecursive(nr) {
console.log("Started function:", nr);
if (nr > 0) {
logRecursive(nr - 1);
} else {
console.log("done with recursion");
}
console.log("Ended function:", nr);
}
logRecursive(3);
function getRecursive(nr) {
console.log(nr);
if (nr > 0) {
getRecursive(--nr);
}
}
getRecursive(3);
function calcFactorial(nr) {
if (nr === 0) {
return 1;
} else {
return nr * calcFactorial(--nr);
}
}