SyntaxFix
Write A Post
Hire A Developer
Questions
Here is one using newer javascript functions fill, map, reduce and constructor (and fat arrow syntax):
Math.factorial = n => n === 0 ? 1 : Array(n).fill(null).map((e,i)=>i+1).reduce((p,c)=>p*c)
Edit: updated to handle n === 0