Unexpected end of JSON input in Film Finder project

Currently I,m doing Film finder project at Intermediate Javascript. In step 11 I,m not being able to see the output in the console and my dropdown is not populating for that. Please help me

const tmdbKey = '2be770c9c3ddb7a92dca494cb31c3a62'; const tmdbBaseUrl = 'https://api.themoviedb.org/3'; const playBtn = document.getElementById('playBtn'); const getGenres = async () => { const genreRequestEndpoint = 'genre/movie/list'; const requestParams = `?api_key=${tmdbKey}`; const urlToFetch = `${tmdbBaseUrl}${genreRequestEndpoint}${requestParams}`; try { const response = await fetch(urlToFetch); if (response.ok) { const jsonResponse = await response.json(); console.log(jsonResponse); } } catch(error) { console.log(error); } }; const getMovies = () => { const selectedGenre = getSelectedGenre(); }; const getMovieInfo = () => { }; // Gets a list of movies and ultimately displays the info of a random movie from the list const showRandomMovie = () => { const movieInfo = document.getElementById('movieInfo'); if (movieInfo.childNodes.length > 0) { clearCurrentMovie(); }; }; getGenres().then(populateGenreDropdown); playBtn.onclick = showRandomMovie;

1 Like

Got the error: I missed a slash in:
const genreRequestEndpoint = ‘genre/movie/list’;

Should be : const genreRequestEndpoint = ‘/genre/movie/list’;

2 Likes