https://www.codecademy.com/en/courses/javascript-project-19/0/4
Oops, try again. false
var isLeapYear = function(year) {
// Your code here
return !(year%4)&&(year%100)||!(year%400);
};
var sum = 0;
for (i = 2000; i < 3000; i++) {
if (isLeapYear(i)) {
sum += 1;
}
}
console.log(sum);
Hi guys,
I can not finish this course because I am stuck on the last exercise. I have tried various solutions and focused on the last (see code above). All the time I get the same error: Oops, try again. false.
I would be grateful for your help,
Mark K.
there are two problems:
determine the number of leap years occurring from 2001 to 2999 AD
you start at 2000 instead of 2001, and the other issue:
Don’t use console.log()
remove the console.log, otherwise it is not going to work
@stetim94
Thank you for your advice!
I changed this code to:
var isLeapYear = function(year) {
// Your code here
return !(year%4)&&(year%100)||!(year%400);
};
var sum = 0;
for (i = 2001; i < 3000; i++) {
if (isLeapYear(i)) {
sum += 1;
}
}
and the problem still exists!
that is weird, i made sure i could pass with the code:
var isLeapYear = function(year) {
// Your code here
return !(year%4)&&(year%100)||!(year%400);
};
var sum = 0;
for (i = 2001; i < 3000; i++) {
if (isLeapYear(i)) {
sum += 1;
}
}
before helping you. Maybe you need to refresh the page?
I have another tip for you, this courses are poorly maintained, you can also go to freecodecamp, they have great js challenges (and codewars of course)
@stetim94
the same issue…
Could it be that the cause of the problem is the version of the browser?
but i passed it:
with your code. Maybe then try a different browser altogether?
@stetim94
Could you tell me please what kind of browser are you using?
Thanks,
Mark
i am just using firefox.
Maybe you should seriously consider freecodecamp, they have great js challenges which are maintained.
1 Like
@stetim94
You were absolutely right! 
The problem was in the browser and now it is resolved! Initially I used Google Chrome and my code could not be accepted by check. Then I followed your advice and tried another web browser (Mozilla Firefox) and now it works fine for me! 
Thank you for your help and I wish you a good day! 
i just suspected that chrome sends cached data to the server, causing a incorrect validation.
2 Likes