This commit is contained in:
Shashi 2024-07-17 10:43:16 +09:00 committed by GitHub
commit eb04541d3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,3 +11,16 @@ export default function factorial(number) {
return result;
}
/**
* @param {number} number
* @return {number}
* Recursive solution
*/
export default function factorial(number){
if (number>=1){
return number*factorial(number-1);
}
else{
return 1
}
}