JavaScript Program Display Time After User Clicks Button

Write a JavaScript program display time after user clicks button.

Source Code
    <title>Display time on button click using function</title>

<p>Click the button to display the date.</p>

<button onclick="displayDate()">The time is?</button>

    function displayDate() {
        document.getElementById("demo").innerHTML = Date();

<p id="demo"></p>


"Coding Hub - Learn to code" app now available on Google Play Store