Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

factorial of number js

const factorialize = num => {
  if (num === 0 || num === 1) {
    return 1;
  }
  for (let i = num - 1; i >= 1; i--) {
    num *= i;
  }
  return num;
};
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #factorial #number #js
ADD COMMENT
Topic
Name
1+1 =