Complete "longest common ..." examples (#100)

* no else return

* fix var ref

* fix importing/requiring dependencies

* complete longest common examples
This commit is contained in:
Max Beatty
2019-03-28 14:52:55 -07:00
committed by Aditya Bhargava
parent c23ca90b83
commit 5b675cc2e8
22 changed files with 235 additions and 125 deletions

View File

@@ -3,9 +3,9 @@ function countdown(i) {
// base case
if (i <= 0) {
return;
} else {
countdown(i-1);
}
countdown(i - 1);
}
countdown(5);

View File

@@ -1,9 +1,8 @@
function fact(x) {
if (x === 1) {
return 1;
} else {
return x * fact(x-1);
}
return x * fact(x - 1);
}
console.log(fact(5));