JSFiddle - React, Tailwind, and code Playground

CoffeeScript

f=(x)->+!x||x*f x-1

min = 0
max = 125

result = (do ->
  for x in [0..5]
    "#{x}!:\t\t#{f x}"
).join "\n"

result += "\n...\n"

result += "#{max}!:\t\t#{f(max).toPrecision(3)}"

result += "\n\n" 

# Test function known to be correct for non-negative integers
factorial = (x) ->
  if x <= 1 then 1
  else x * factorial(x - 1)
            
result += do ->
  for x in [min..max]
    if f(x) isnt factorial(x)
       return "Incorrect result for " + x
  "Correct for all integers #{min} to #{max}"

alert result