Since a factorial is simply degenerative multiplication from the number given down to 1, it would indeed be easier to just loop through the multiplication:
Math.factorial = function(n) {
if (n === 0||n === 1) {
return 1;
} else {
for(var i = n; i > 0; --i) { //always make sure to decrement the value BEFORE it's tacked onto the original as a product
n *= i;
}
return n;
}
}