Skip to content

Instantly share code, notes, and snippets.

@NEbere NEbere/factorise.js
Created Feb 11, 2016

Embed
What would you like to do?
Factorisation of a digit in javascript
function factorialize(num) {
//check if num == 0
if (num === 0) {
return 1;
}
//else calculate factorial
return num * factorialize(num - 1);
}
//calling the function. this will return 120
factorialize(5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.