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.

JavaScript Introduction to Programming Objects and Arrays Arrays

Incrementing Confusion

Introduction to Programming Course

Arrays Video

At 14:09 of the video, after adding the incrementer to his friends loop and running the script in the browser, he says the loop starts with Nick. Yet if you look at the console, it starts with Michael, then goes to Nick, then back to Michael, then the rest of his friend's names. Is that how the output was supposed to look or did he do something wrong there?

2 Answers

Hi Christian,

The 1st Michael was from the following code before the for loop:

var friendNumber = 1;
console.log(friends[friendNumber]);

That logged Michael then the for loop started with Nick, then Michael, etc...

Each time the page is refreshed it's running all of the script. Not just the newest code he has added.

Okay thanks Jason. Now I understand it. I have to admit these Javascript videos are a bit tough to follow.