Skip to content

Instantly share code, notes, and snippets.

@AdrianSkar
Last active February 19, 2018 19:44
Show Gist options
  • Save AdrianSkar/58395caa903e5211dfd3d9303cf3811f to your computer and use it in GitHub Desktop.
Save AdrianSkar/58395caa903e5211dfd3d9303cf3811f to your computer and use it in GitHub Desktop.
freeCodeCamp exercise: JS factorialize a number
// Using a while loop
function factorialize(num) {
if (num == 0){
return 1;
}
var result = 1;
while (num>0){
result *= num;
num--;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment