Skip to content

Instantly share code, notes, and snippets.

@nicholasaiello
Created October 3, 2017 20:46
Show Gist options
  • Save nicholasaiello/753e2060553d0db4db1664aff29002e9 to your computer and use it in GitHub Desktop.
Save nicholasaiello/753e2060553d0db4db1664aff29002e9 to your computer and use it in GitHub Desktop.
// return the factorial
const fact = (f) => (
Array.from({length: f}, (v, i) => i + 1).reduce((sum, v) => sum *= v, 1)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment