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!

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

Genesis Mukassa
Genesis Mukassa
1,713 Points

createListItems is not defined

Hi everyone, this is my code and for some reason i keep getting createListItems is not defined. Where have I gone wrong?

const playlist = [ 'So What', 'Respect', 'What a Wonderful World', 'At Last', 'Three Little Birds', 'The Way You Look Tonight' ];

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

thank you.

1 Answer

Steven Parker
Steven Parker
228,001 Points

When posting code, always use Markdown formatting to preserve the code's appearance,. And for when your question refers to something you are doing in a workspace, an even better way is to make a snapshot of your workspace and post a link to it. You may also want to take a look at this video about Posting a Question.

But there's no obvious problem in this code (other than the accent marks did not come through). Perhaps the issue is in other project code? A snapshot would allow us to see.