My solution to Factorialize a Number challenge

Do you guys this is an okay code? Any suggestions for improvement? :slight_smile:

function factorialize(num) {
  var result = 1;
  for (var i=num; i >= 1; i--) {
    result *= i;
  return result;
1 Like

Thanks a lot! Your feedback means a lot to me. :wink:

I used recursion to solve mine, just because I wanted to use it! Point noted. Great post as usual, @P1xt.

@Milos2709 Nice job! Your solution looks clean and efficient.

Thanks @dpberry552. I am glad these algorithm challenges aren’t as difficult as I feared them to be :slight_smile:

Easy to understand :slight_smile:

function factorialize(num) {
  var result = 1; // set to 1 because multiplying to 0 results in 0
  for(i=1; i<=num; i++){ // get 1,2,3,4,5
    console.log(result *= i); // multiply 1*2*3*4*5*(1) = 120