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 trial

JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops Create a for Loop

Where to start on this challenge?

Hi there, I've been away on break for a few days, and when I got back, the information I learned sort of temporarily slipped from my mind! xD! Would someone here have a helpful hint to help me get back on track with this challenge? Thanks in advance!

script.js

2 Answers

Steven Parker
Steven Parker
231,269 Points

Instead of jumping back in on the challenge, why not review the last video as a warm up? Looks like you last saw For Loops, which should contain most of what you need to solve this challenge.

Ok, I'll do that. Thanks!

Gianmarco Mazzoran
Gianmarco Mazzoran
22,076 Points

Hi Gabriel D, to run a for loop in javascript you have initially to open the for loop

for () {
}

then you have to pass a parameter that start to count from 4 till 156. Generally you use a variable called $i and check if the variable correspond to 156, if not add 1 to the variable $i like this:

for ($i=4; $i<=156; $i++) {
}

then you have to print out the $i variable with the console.log() method.

for ($i=4; $i<=156; $i++) {
console.log($i)
}