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

Samuel Catchpole-Radford
8,081 Pointswhen i use exactly the same code as in the video, everything works but it only prints the last object to my page
So i have used exactly the same code in my own .js file and it only prints the last object in the array onto the page, i have 3 objects in the array but when the for loop runs it ignores the first 2 objects? any help?
2 Answers

rydavim
18,814 PointsWithout seeing your code, my guess is that you're using innerHTML and overwriting it for each element in your array. Does it work if you add everything to a variable like message and then print the variable?
If that doesn't help, you'll be able to get a more specific answer if you post your code.

Samuel Catchpole-Radford
8,081 PointsThanks, i fixed it now thankfully, after ages looking at the code i realised i wasn't using += for my first message variable after setting it at the top of the .js file. I changed it and all worked ok.

rydavim
18,814 PointsThat would do it! Glad you got it sorted. :)