Basic Algorithm - Factorialize a Number

Hey, I’m looking for some input on my code for this challenge in Basic Algorithms - Factorialize a Number, I passed the test, but my code seems to be very different then most others; using the while format. Am I doing this in a weird way? Thanks in advance for the comments!

function factorialize(num) {
  var x = 1;
  var y = 1;
  while (x <= num) {
    y = y * x;
    x++;
  }  
  return y;
}

factorialize(5);

It’s not weird at all.

You can of course eliminate the need for this x variable, by using num in the following way:

Instead of counting up to num with x, decrement num itself and compare to 0.

Ahh right, good to know

Thanks Randell, I’ll keep this in mind for future posts; and thanks for the comment!

Thanks, I like eliminating the x variable, I’ll give it a shot using your solution, thanks for the help!