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

Robert Rydlewski
Robert Rydlewski
3,828 Points

I need help. I fallow the teacher exactly but in my option, this doesn't work why ??

This is the code form playlist.js ( I named app.js) ```var playList = []; playList.push('I Did It My Way');

printList(playList);```

This is the html code ```<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Musical Playlist</title> <link rel="stylesheet" href="css/styles.css"> </head> <body> <h1>My Music Playlist</h1> <div id="listDiv">

</div> <script src="js/helper.js"></script> <script src="js/app.js"></script> </body> </html>``` As I mention I named it app.js insted player.js but this is not the issue here.

Helpers.js file I didn't touch it, as the function was already written.

I am getting 2 errors : "helper.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)"

and secound:"Uncaught ReferenceError: printList is not defined at app.js:4"

the 4th line is printList(playList)

I downloaded this file on my own computer and tried, but still don't work. Strange as the code is exactly the same as teacher provide. Any clue what's is wrong with it ??

1 Answer

The problem is in your html

<script src="js/helper.js">

The file name is helpers.js with an s. So it should be:

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