how to make a factorial function in javascript
function factorialize(num) {
if (num === 0 || num === 1)
return 1;
for (var i = num - 1; i >= 1; i--) {
num *= i;
}
return num;
}
factorialize(5);function factorialize(num) {
var result = num;
if (num === 0 || num === 1)
return 1;
while (num > 1) {
num--;
result *= num;
}
return result;
}
Also in JavaScript:
- Discord.js ban command
- open link in new tab jquery
- flutter app accessible when phone is locked
- javascript remove underscore and capitalize
- how to send json data in fetch request body
- check if number appears odd number of times in array javascript
- delete value from json array with index
- offset in js
- jquery create element properties
- java.lang.IllegalArgumentException: Can only download HTTP/HTTPS
- split whitespace except in quotes javascript
- javascript validate date
- react list
- How to install react native hooks with npm
- node cluster
- dom get all tags
- javascript function in brackets
- what is angularjs
- get random numbers javascript
- check for string in string javascript
- get attribute value jquery href
- javascript dice throw
- express ssl
- typescript filter array of null