JavaScript Program to Display Today's Day

Write a JavaScript program to display today's day. This program will read date and after that it will display the day of the week.



Source Code
<html>
<head>
    <title>Display Today's Day</title>
</head>
<body>
<h3>Today is</h3>
<p id="day"></p>
<script type="text/javascript">
    switch(new Date().getDay())
    {
        case 0: text = "Sunday";
            break;
        case 1: text = "Monday";
            break;
        case 2: text = "Tuesday";
            break;
        case 3: text = "Wednesday";
            break;
        case 4: text = "Thursday";
            break;
        case 5: text = "Friday";
            break;
        case 6: text = "Saturday";
            break;
    }
    document.getElementById("day").innerHTML = text;
</script>
</body>
</html>
Output





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