Tell us what’s happening:
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.
Your code so far
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(5);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36
.
Link to the challenge: