Guys, help me please with this factorialize challenge

Guys, help me please with this factorialize challenge
0

#1

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;  
}

#2

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


#3

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


#4

yep! thanks for your time!