Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Trevon Allen
6,742 Pointsanyone know where I'm going wrong?
its saying I'm logging 1 number and need to log 12 I know I'm missing something in this but not sure what any help is appreciated
var num = 0;
var number;
function number(){
return console.log();
}
do{
num += 2
}while (num < 24){
}
number();
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
2 Answers

Steven Parker
215,231 PointsHere's a few hints:
- you don't need a function for this challenge
- but if you want to use one, it needs to take an argument (and log it out)
- you need to log the number (or call your function) from inside the loop

Christian Clarke
7,963 PointsLooking at this there are probably a few things you can change to get it to work! First, it looks like you you're calling a function once which will only give you a singular log. You can just log the number within the loop instead of doing that separately! Second, be sure that you have something in the log method i.e console.log(num).

Trevon Allen
6,742 Pointsappreciate the guidance I was able to use a for loop to resolve it for( I=2; I<25; I+=2){ console.log(i); }
putting the I in the console definitely helped appreciate it
Trevon Allen
6,742 PointsTrevon Allen
6,742 Pointsappreciate the guidance I was able to use a for loop to resolve it for( I=2; I<25; I+=2){ console.log(i); }
Steven Parker
215,231 PointsSteven Parker
215,231 PointsThe "do" loop would have also worked with the same loop body.
Glad I could help. And happy holidays!