Learn Basic String and Array Methods by Building a Music Player - Step 1

Tell us what’s happening:

even after declaring the correct variable the tests are not getting passed

Your code so far

const playlistSongs = getElementById(“playlist-songs”);

const playButton = getElementById(‘play’);

const pauseButton = getElementById(‘pause’);

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

const playlistSongs = getElementById("playlist-songs");
const playButton = getElementById('play');
const pauseButton = getElementById('pause');

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36

Challenge Information:

Learn Basic String and Array Methods by Building a Music Player - Step 1

The getElementById function is used in HTML to find an element that has a specific ID within the document. However, in your code, you are not referencing the document object, which is necessary for getElementById to work correctly. The document object represents the current HTML document and is essential for interacting with elements in the DOM (Document Object Model).

To use getElementById properly, you need to ensure that the script where you are using this function is linked to the HTML document. This means that the HTML document should include a reference to the script containing the getElementById call. In this lesson, you probably added a <script> tag in the HTML file to link to your JavaScript code.

For more information you can look related documentation.

You’re missing the document object on your selectors.

const playlistSongs = document.getElementById(‘playlist-songs’);
const playButton = document.getElementById(‘play’);
const pauseButton = document.getElementById(‘pause’);

Hope that helps!

after finishing all steps, i went back to step 1 and saw my error. i had “Eelement” instead of “Element”