Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJorge Archila
2,124 Pointsmy code is not working, but for me is correct
var count=2;
while(count<=24){ console.log(count); count+=1; }
var count=2;
while(count<=24){
console.log(count);
count+=1;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHey Jorge,
While you're code is correct in syntax, it is incorrect in what the challenge is asking for. The challenge wants you to log all the even numbers from 2 to 24 (should output 12 numbers), but you have your count variable
only incrementing by 1, which will tell the code to include the odd numbers too.
If you change your count to count +=2;
you'll be good to go.
Keep Coding! :)