Trouble with Factorialize a Number

Exactly does how one write the mathematics for factorialization? I guess I’m not sure what to multiply together to get the numbers written next to the red X’s.


There is a Javascript function that does just that but you’re not supposed to use it. You have to figure out your own function.

So for a given number (for example 5), you have to return 5 * 4 * 3 * 2 *1 (= 120.)

You have to think logically, and I don’t know if you remember having worked with an accumulator in the previous exercises?

function factorialize(num) {
num = 123456789*10;
return num;


So something like this.

Well that depends on the number. Your code inside the function will work for the number 10.

So I need to get the function to work for all those numbers. Is this possible with arrays?

I’m thinking of a way to explain that but I’m not that comfortable with that challenge :grin:

You can look up here : you will get several hints to put you on the right tracks.

And if you’re thinking of arrays, then go for it. Whatever works !

By defintion, a factorial is a number multiplied by ever preceding number until 0 is reached. For example:

5! = 54321

This can be expressed as n! = n * (n-1) * (n-2)… * 1. This is what you want to try and code. One solution could involve a loop. There is another, more elegant solution as well using Recursion but that’s outside the scope of this course.