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

"Adding to Data Arrays | Javascript" Lesson Issue

I've written out the code exactly as portrayed in the video, and I've rechecked it a few times, as well as the links to the scripts in the HTML folder, but for some reason the values I'm pushing to the array in exercise aren't being shown in the web browser, nor are any errors being shown in the console.

Would someone more experienced be able to take a quick gander at my code and tell me if I'm doing something off?

var playList = [ ];
playList.push('I Did It My Way');
playList.push('Respect', 'Imagine');

printList(playList);

Hi, Your code works when I use console.log() instead of printList(). How do you have the printList() function coded?

1 Answer

Steven Parker
Steven Parker
231,141 Points

There's nothing obviously wrong in this little bit of code. Please show the whole code.

A better way to share is to make a snapshot of your workspace and post the link to it here.