Factorialize a Number - antoniojvargas/FreeCodeCamp GitHub Wiki

Factorialize a Number

Return the factorial of the provided integer.

If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.

Factorials are often represented with the shorthand notation n!

For example: 5! = 1 * 2 * 3 * 4 * 5 = 120

function factorialize(num) {
  var fact = 1;
  var cont = 1;
  if(num === 0){
	return 1;
  }
  while(num > 1){
	fact = fact * (num);
	num--;
  }
  
  return fact;
}

factorialize(5);