Skip to content

Commit 9b1161b

Browse files
Update Factorial.js
1 parent 60ac2f0 commit 9b1161b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

JavaScript Interview Programs/Factorial.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ function factorial(n) {
1010
}
1111
return fact;
1212
}
13-
console.log("Factorial (using For Loop):", factorial(5));
13+
console.log("Factorial using For Loop:", factorial(5));
1414
// Output:
15-
// Factorial (using For Loop): 120
15+
// Factorial using For Loop: 120
1616

1717
// OR
1818

1919
// Find factorial Using Recursion:
2020
function factorial(n) {
2121
if (n <= 1) return 1;
22-
return n * factorialRec(n - 1);
22+
return n * factorial(n - 1);
2323
}
2424
console.log("Factorial using Recursion:", factorial(5));
2525
// Output:

0 commit comments

Comments
 (0)