Getting the day of the week in JavaScript

You can also use the Date object to get the number of the current day of the week. This is done using the getDay method. This method returns numbers from 0 to 6, where week starts on Sunday and this day is numbered 0. Monday is day number 1, Tuesday is day number 2, and so on.

Let's see how the getDay method works with an example. Let's say today is Tuesday. Then the following code will output the number 2:

javascriptlet date = new Date();
console.log(date.getDay());
Задание 1

Display the number of the current day of the week.

Задание 2

Determine if the current day of the week is a weekend or a workday.

Задание 3

Find out how many days are left until next Sunday.