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 Tracking Multiple Items with Arrays Using For Loops with Arrays

Jerzy Kozak
PLUS
Jerzy Kozak
Courses Plus Student 17,049 Points

Am I just started to think like a programmer? ;)

At 01:23 of these video I have that idea to put for loop like this: for(i=0, i<student.length, i+=1). It comed naturally first second I was thinking about creating the loop.

Maciej Sularz
Maciej Sularz
15,088 Points

do not forget to declare the variable i first like so

for( var i = 0, i < student.length, i += 1) {
    // Do something awesome here
}

4 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

I'm not entirely sure what it means, if there's a right or wrong way to think like a programmer but if you're looking at code and able to think of solutions to solve problems then you're well on the way. :-)

Programming is not so much about memorising code (although of course it helps) but thinking of creative ways to solve problems and if you'er not sure how, looking at the documentation or other places to get the answers.

Yeah those moments like that are cool. I use another programming language called M and it is very common to loop through a data structure that is the same as an array. There loop has a very similar syntax and a very similar trick to get the length.

Rahat Kapoor
Rahat Kapoor
4,242 Points

no your not thinking like a programmer and your seriously cocky and if your cocky you will never learn because you always think your right

Jerzy Kozak
PLUS
Jerzy Kozak
Courses Plus Student 17,049 Points

Dear Rahar, I don't really know why you're insulting me? What is wrong with you?