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 Loops, Arrays and Objects Tracking Multiple Items with Arrays Adding Data to Arrays

Aleksejs Sitdikovs
Aleksejs Sitdikovs
4,076 Points

Not working JS script printList

Hello everyone, I don't know why, but for me, JS Script printList from file helpers.js is not working. I did assign it in HTML file, but in a console, it shows. "printList is not defined at playlist.js:4" HTML file: <scrit src="js/helpers.js"></scrit> <script src="js/playlist.js"></script>

playlist.js : var playList = []; playList.push("I Did It My Way");

printList( playList);

I have checked, the file is assigned correctly, camelToe is used everywhere. I don't know, what causes that problem, any ideas? Or it is just a bug from Chrome?

handy christian - check out the markdown cheat sheet at the bottom of the page

Not sure. I'd have to see the complete code.

3 Answers

It looks like you have

<scrit src="js/helpers.js"></scrit>

instead of

<script src="js/helpers.js"></script>
Aleksejs Sitdikovs
Aleksejs Sitdikovs
4,076 Points

Lol, really? :D Jeeez, I will need to change my glasses, I inspected that line for like 20 times :D

handy christian
handy christian
2,899 Points

hey, how to make a code printed with background black behind in it?

Omar Ocampo

Javascript is case sensitive. You declared playlist with a lowercase l. But then you use methods on playList with an uppercase L. This results in error: Uncaught ReferenceError: playList is not defined.

Change the l to uppercase in your first two lines of code so you have:

var playList = [];
playList.push('I did it my way');
playList.push('Respect','Imagine');
playList.push('Johana');
playList.unshift ('Born to run');

printList( playList );

You're absolutely right Kris, thanks a lot. Oh by the way, I have a " > " signal appearing at the end of the list, could you please check again and let me know why?

Thanks again

Omar

This is not an answer, is a question

var playlist = []; playlist.push ('I did it my way'); playList.push ('Respect','Imagine'); playList.push('Johana'); playList.unshift ('Born to run');

printList( playList );

Hey guys, could anyone help me with this, is not print the spectated list, I'm following the Dave McFarland video, thanks in advance for your help.