Skip to content

Instantly share code, notes, and snippets.

@adatg
Created October 29, 2018 18:25
Show Gist options
  • Select an option

  • Save adatg/1facb5a50a4e9980e53d3230a77fe7ea to your computer and use it in GitHub Desktop.

Select an option

Save adatg/1facb5a50a4e9980e53d3230a77fe7ea to your computer and use it in GitHub Desktop.
Calculate factorial
function factorial(num) {
var result= 1;
for (var i = 2; i <= num; i++) {
result *= i;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment