Skip to content

Instantly share code, notes, and snippets.

@Rudxain
Last active April 28, 2025 18:03
Show Gist options
  • Save Rudxain/c06a6800807233fe6e74f179dda750a8 to your computer and use it in GitHub Desktop.
Save Rudxain/c06a6800807233fe6e74f179dda750a8 to your computer and use it in GitHub Desktop.
The smallest (golfed) polymorphic factorial in JavaScript. Supports BigInts and interpolates non-integer Numbers. Doesn't support negatives or NaN. Must be prefixed by `let ` to run in strict mode
f=x=>x>1?x*f(--x):(x^=x,x**x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment