JSFiddle - React, Tailwind, and code Playground

HTML

<input id="t1" type="text">

<button type="button" onclick="myfunction()" >click me</button>

<p id="demo">A Paragraph.<br/></p>

JavaScript

function myfunction() {
    var no=document.getElementById("t1").value;

    if(no==""||isNaN(no))
    {
    alert("Not Numeric");
    }
    else {

        for ( var int = 0; int < no; int++) {
            for ( var int2 = 0; int2 <=int; int2++) {
                document.getElementById("demo").innerHTML+="*";
            }
            document.getElementById("demo").innerHTML+="<br>";
        }
    }
}