I tried making a function that takes a parameter, and puts every number less then the parameter up to zero and pushes it into an array(descending order). and then used a for loop to multiply each index of the array by the next index, but my return comes back null. please help.
function factorialize(num) {
var arrayOfFactorial = [];
var factorial = 1;
for(var i = num;i > 0;i--){
arrayOfFactorial.push([i]);
factorial = factorial * arrayOfFactorial[i];
}
return factorial;
}
factorialize(10);