JSFiddle - React, Tailwind, and code Playground

by JonVisc

HTML

<div id="t"></div>

JavaScript

var num = prompt('enter a number for factorial multiplication');

function t(answer) {
    $('#t').html(answer);
}

function factorial(start, total) {
    while (start > 1) {
        return factorial(start - 1, total * start);
    }
    return total;    
}

t(factorial(num, 1));