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.

# Trouble with Factorialize a Number

**timotheap**#2

Hello,

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?

**nameoferic**#4

function factorialize(num) {

num = 1*2*3*4*5*6*7*8*9*10;

return num;

}

factorialize(5);

So something like this.

**timotheap**#5

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

**nameoferic**#6

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

**timotheap**#7

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

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 !

**rschron**#8

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

5! = 5*4*3*2*1

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.