Why isn't my code correct?

Here’s a picture of my code. The result is 120 so im not sure why it isnt accepting it.

41 PM

You haven’t provided any context for this, but I’m going to guess that it’s because you’re using a global variable.

Since you place var result outside the function (and you don’t clear it everytime you run the function) its value will keep increasing. So, only the first run will be correct, but the tests will run your code several times.

Thank you! And yeah my bad for not providing any context, I am working on the factorialize algorithm exercise.