javascript - take the number parameter been passed and return the factorial of it, For example: if number is 4, it should return (4 * 3 * 2 * 1) which is 24 -


have function factorial(number), take number parameter been passed , return factorial of it.

for example: if number 4, should return (4 * 3 * 2 * 1) 24

function factorial(number) {      return (number <= 1) ? 1 : factorial(number - 1) * number;  }    alert(factorial(4));


Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -