I believe that the solutions offered to this challenge do not consider the special case where one tries to calculate the factorial of a negative number (it is not defined.) Here’s my solution:

function factorialize(num) {
let factor;
if (num < 0) {
factor = "undefined";
} else if (num == 0 | num == 1) {
factor = 1;
} else {
factor = num*factorialize(num - 1);
}
return factor;
}
console.log(factorialize(5));

The solutions offered do not consider the negative number case.

Generally we avoid adding much input checking to the Guide solutions to keep them simpler.

That said, thinking about input validity is important and will help you in the future.

I would avoid going through the if-else logic with a bunch of recursion, personally:

function factorialize(num) {
if (num < 0 || !Number.isInteger(num)) {
// Note: num! is well defined but
// but not covered by the formula below
return undefined; // no need for "", this is a primative
} else {
let factorial = 1;
for (let i = 2; i <= num; i++) factorial *= i;
return factorial;
}
}
console.log(factorialize(5));