What's wrong with this code ? was trying to make a Program that could detect if it's a leap year or not ...?¿ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong with this code ? was trying to make a Program that could detect if it's a leap year or not ...?¿

alert ("Find out if it's leap year") var year=prompt("Enter the passing year") switch (year){ case year/4===0: document.write("Leap year"); default: document.write("Normal"); }

15th Sep 2020, 5:37 PM
Nahian Suhaimee
Nahian Suhaimee - avatar
2 Answers
+ 3
/ return you the quotient of division not remainder. try% instead of / for your desired result.
16th Sep 2020, 5:05 AM
Divya Mohan
Divya Mohan - avatar
+ 2
please ask Google for leap year rules.
15th Sep 2020, 5:42 PM
Oma Falk
Oma Falk - avatar