Help with Factorialize a Number algorithm

help, i have been for two hours trying to figure out how to resolve this… used while, for… but i cant do the last part.

this is what i have:

thanks for the help.

You are not allowed to call reduce on an empty array without an initial value. Passing a “initial value” of 1 solves the problem.

function factorialize(num){
  var array = [];
  for(var i = 1; i <= num; i++){
  factor = array.reduce(function(a,b){
    return a*b;
  }, 1);
  return factor;