Open redahaq opened 4 years ago
Sorry to be contrary, but I disagree 😅
It's pretty common to use function declarations for top-level functions and then arrow functions for callbacks, as you have (this is usually how I write code).
It's definitely good to be familiar with ES6 features, but they don't necessarily replace older stuff. Arrow functions aren't strictly better—they just look different (and have slightly different behaviour when it comes to this
).
You have a mix of ES5 and ES6 syntax going on, which is totally normal at this stage, but it would be great to see you transition to using ES6 from next week.
I can see you're using ES6 when using the forEach higher order function, and with Promises, which didn't really exist before ES6.
Eg your function 'fetchRequest' can be refactored from
function fetchRequest(movieName) { fetch(
https://api.themoviedb.org/3/search/movie?api_key=62b96ba98a33d55afab20dba768c38e2&query=${movieName})
etcto:
fetchRequest = (movieName) => { fetch(
https://api.themoviedb.org/3/search/movie?api_key=62b96ba98a33d55afab20dba768c38e2&query=${movieName})
etc **** you don't need the parentheses around 'movieName' when you're only passing in one parameter, but I left it in there as you'll need the parens if you have more params