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 Arrays Loop Through Arrays Loop Through an Array

result '' after function. += wont work

function createListItems(arr) { let items = ''; for (let i=0; i< arr.legnth; i++) { items += <li>${ arr[i] }</li>; } return items; }

this is my code and my result is: ''

Caleb Kemp
Caleb Kemp
12,754 Points

If that is actually your code, perhaps the problem is being caused because you spelled "length" as "legnth"? Just a thought...

1 Answer

Ashley Schott
Ashley Schott
7,944 Points

It looks like you may have set your items variable equal to a double quote (") instead of using an empty string of two single quotes (' ').