Tell us what’s happening:
Describe your issue in detail here.
My code runs perfectly if I use “var” inside the for loop to initiate “product” but I get an error message saying “ReferenceError: product is not defined” if I use “let” instead of “var”, why?
**Your code so far**
function factorialize(num) {
for (let product = 1; num > 0; num--) {
product *= num;
}
return product;
}
factorialize(5);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
Challenge: Factorialize a Number
Link to the challenge: