JavaScript Date Object provides a method that returns the number value for day of week for the specified Date value. JavaScript getDay() method returns the day of week associated to the specified Date. It returns the value between 0 and 6 starting from 0 = sunday, 1 = monday and so on. Now lets try the following sample code to understand the logic behind it: