map takes an array and produces another array of the same size by applying the function you give it as a callback to each one.
function times2 (n) {
return n * 2;
}
[1,2,3].map(times2)
// This returns [2,4,6]
So for this line:
moviesInfo.map(m => console.log(m.Title))
You are trying to mapping each value in moviesInfo to whatever console.log returns (it’s always undefined, so you’re just mapping every value to undefined). for each is what you use, but in this case it really isn’t what you want, just want to see what your thinking behind the code is
You are doing something wierd here, and I think you’re misunderstanding both how map works, and how to deal with async fetching of data in JS.
Can your explain the code you’ve written here, what you think it is doing?
im trying to retrieve details of a movie using their imdbId. favImdbList is an array has user favorite movie ids as Strings. so im mapping through each id and retreiving the data from omdbapi and pushing data Object inside the moviesInfo array but now how to iterate this ?? foreach is also not working