Finding the Factorial using Recursion in javascript.
function factorial(x) {
if(x <= 1) return 1;
return x*factorial(x-1);
}
factorial(5);
Byte sized tech know-how.
Finding the Factorial using Recursion in javascript.
function factorial(x) {
if(x <= 1) return 1;
return x*factorial(x-1);
}
factorial(5);
Copyright © 2024 Txt