Hey there,

I’m at the algorithm challenges and I love them!

but at the second one I feel like i cheated a little

(https://www.freecodecamp.org/challenges/factorialize-a-number)

I got everything right except for the last one, if you type 0 it should return 1, doesn’t make sense cause multiply anything with zero you’ll get zero.

so I just typed an if/else statement but I’m not sure if it’s the right way to go.

```
function factorialize(num) {
var factorArray = [];
for(var i = 1 ; i < num ; i++){
factorArray.push(i);
}
for(var j = 1 ; j < factorArray.length ; j++){
num = num * factorArray[j];
}
if(num >= 1){
return num;
}
else{
return 1;
}
return num;
}
factorialize(0);
```

can anyone tell me if I’m doing it right?

thnks!