Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created December 29, 2018 03:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save parzibyte/45bfd2c25ab0b7e1e0140b196d25424d to your computer and use it in GitHub Desktop.
Factorial de un número con BigInt
const factorial = numero => {
if (numero < 0n) numero = numero * -1n;
if (numero <= 0n) return 1n;
let factorial = BigInt(1);
while (numero > 1) {
factorial = factorial * numero;
numero--;
}
return factorial;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment