I tried the Film Finder project in the back-end course, and I encountered a problem:
Uncaught (in promise) TypeError: genres is not iterable
at populateGenreDropdown (helpers.js:5:25) - Error is showed up when I try to run the code!
I left the const tmdbKey empty, just for the screenshots!
here is the whole code:
I’m just guessing, but maybe
const genres = jsonResponse.genres;
const genres = await jsonResponse.genres;
And similarly for
const movies in the next function.
Next time, please post code using the </> button (and then paste the code on the lines between the ``` and ``` instead of using a series of screenshots.
still DONT WORK
now the error is :
helpers.js:76 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘length’)
at getRandomMovie (helpers.js:76:59)
at HTMLButtonElement.showRandomMovie (script.js:64:23)
getRandomMovie @ helpers.js:76
showRandomMovie @ script.js:64
It looks like your
getMovies function is missing
did you resolve the problem? I guess I have the same error
not yet, but I think is because the The version is not upgraded (of the project file)
hi there, I have the same error.
const jsonRepsonse = await response.json(); solved the problem.
I am new at the forums and just replied below. Your solution solved the issue. Thanks!
I had a similar error (at (helpers.js:5:25)) and the genres object did not appear when I console logged the jsonresponse variable to the console. I had made a mistake by not enclosing the requestParams variable in temporal literals and instead used normal quotation marks. When I correct this I still had the (helpers.js:5:25) problem but worked through to the end of step 12 and the genres appeared in the dropdown box in the viewer for the film finder website. I am hopeful that the (helpers.js:5:25) error will resolve as I complete later steps as it did say that viewing the console (press F12) will show up a lot of errors but don’t worry about them for now.