Guys, help me please with this factorialize challenge

What wrong with this way?

var arr =[];
var result = 0;
function factorialize(num) {
  if (num != 0) {
    for (var i = 1; i <= num; i++) {
    arr.push(i);
    }
     result = arr.reduce(function(x,y){
        return x*y;
    }); return result;
  } else return 1;  
}

thanks, it helps me to replace variables inside the function!

So, you’ve got a solution to your problem?

yep! thanks for your time!