Film Finder Project: Step 11 Console ReferenceError

Hi, I can’t get past step 11. I get an error in the console:

ReferenceError: jsonResponse is not defined at getGenres (script.js:15:19)

When I console.log the urlToFetch and click the link, I get the genres. So, I’m not sure why I’m getting the error. I appreciate any help.

const tmdbKey = 'XXXXXXXXXXXXXXX';
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 jsonReponse = 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;

Do you see the typo here?

3 Likes

Thank you! I looked over it so many times too…

1 Like