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 trialAlex Smith
5,133 PointsPractice objective. Need help again.
the error message is telling me, i'm only running the code one time (as opposed to 4 - 156, i suppose). what would i change to run this the way it's expecting?
let html = '';
for ( let i = 4; i <= 156; i += 1) {
html += `${i}`;
}
console.log(html);
2 Answers
Steven Parker
231,275 PointsThe problem isn't the loop running, but that you do the logging just one time after the loop ends.
Do the logging inside the loop and you won't need to create the "html" variable, or convert the number into a string manually.
Alex Smith
5,133 PointsThank you!