How to get current day name with JavaScript

If you want to show current day name on your web page, follow these steps:How to get current day name with JavaScript How to get current day name with JavaScriptexpoundsofttechsolution

1. First of all create a variable of day names array, like this:

var weekdays = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];

2. And then get current date in a variable like this:

var myDate=new Date();

3. Then we can get current day name with this type of code:

var day = weekdays[myDate.getDay()];

4. Now you can use this “day” variable to show in your web page, like this:

alert(day);
Now you can see current day name in alert, like this:

Saturday