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 trialKelly Castle
10,547 PointsCan someone please explain to me in further detail how exactly the addition assignment is working in this function?
Can someone please explain to me in further detail how exactly the addition assignment is working in this function? I understand the concept of the addition assignment and how it works, but for some reason I can't seem to wrap my brain around how it's working in this loop. I don't understand how that's creating the loop. Feelin' like it's an obvious answer... just can't seem to get there on my own... help! :) THANKS!
2 Answers
Jonathan Hermansen
25,935 PointsNot quite sure what you mean about "I don't understand how that's creating the loop.", but the addition assignment simply adds an <h2>, <h3>, <p>, and <img> element for every pet object from your pets.js in every loop. Like this:
First loop
<h2>name of first pet</h2>
<h3>Type | Breed</h3>
<p>Age</p>
<img ....>
Second loop
<h2>name of first pet</h2>
<h3>Type | Breed</h3>
<p>Age</p>
<img ....>
<h2>name of second pet</h2>
<h3>Type | Breed</h3>
<p>Age</p>
<img ....>
Third loop
<h2>name of first pet</h2>
<h3>Type | Breed</h3>
<p>Age</p>
<img ....>
<h2>name of second pet</h2>
<h3>Type | Breed</h3>
<p>Age</p>
<img ....>
<h2>name of thridpet</h2>
<h3>Type | Breed</h3>
<p>Age</p>
<img ....>
etc..
In the end you got all the html code for all the pets in your pets.js.
Kelly Castle
10,547 PointsThank you!! This helps!!