Q:

Write a JavaScript program to find 1st January is being a Sunday between 2014 and 2050

0

Write a JavaScript program to find 1st January is being a Sunday between 2014 and 2050.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

console.log('--------------------');
for (var year = 2014; year <= 2050; year++)
    {
    var d = new Date(year, 0, 1);
    if ( d.getDay() === 0 )
        console.log("1st January is being a Sunday  "+year);
    }
console.log('--------------------');

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now