Skip to content

Commit 86a7806

Browse files
chapter example fix
1 parent fb8f397 commit 86a7806

File tree

1 file changed

+2
-3
lines changed
  • more-on-functions/chapter-examples/recursion-base-case

1 file changed

+2
-3
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
//The following concept check assumes that only positive integers are passed to the function.
22

33
function factorial(integer){
4-
if (/*enter base case test here*/){
5-
return integer;
4+
if (integer < 5){
5+
console.log(integer);
66
} else {
77
return integer*(factorial(integer-1));
88
}
99
}
1010

11-
console.log(factorial(4));
1211

1312
//Skill boost! Add validation to return an error message if the function is passed a string, negative number or a decimal value.

0 commit comments

Comments
 (0)