JSFiddle - React, Tailwind, and code Playground

HTML

<p>Click the button to demonstrate the prompt box.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>

JavaScript

var monthNames = [ "January", "February", "March", "April", "May", "June",
    "July", "August", "September", "October", "November", "December" ];
function myFunction() {
    var today = new Date();
    var date = prompt("Please enter date.", today.getDate()+"/"+today.getMonth()+"/"+today.getFullYear());

    if (date != null) {
                                                                             x = "Hello! You have entered date as: " + date;
        document.getElementById("demo").innerHTML = x;
    }
}