1// Return today's date and time
2var currentTime = new Date()
3
4// returns the month (from 0 to 11)
5var month = currentTime.getMonth() + 1
6
7// returns the day of the month (from 1 to 31)
8var day = currentTime.getDate()
9
10// returns the year (four digits)
11var year = currentTime.getFullYear()
12
13// write output MM/dd/yyyy
14document.write(month + "/" + day + "/" + year)
1
2const year = prompt("enter year");
3debugger;
4if(year%4==0){
5 if(year%100==0){
6 if(year%400==0){
7 console.log(year + " is leap year")
8
9 }
10
11 else{
12 console.log(year + " is not a leap year");
13 }
14
15}else {
16 console.log(year +" is a leap year");
17}
18}else {
19 console.log("the year "+ year + "is not a leap year");
20}