const filterMovies = !filter ? movies : movies.filter((movie) => movie.info.title.includes(filter));
filterMovies.forEach((movie) => {
const movieEl = document.createElement('li');
let text = movie.info.title + ' - ';
for (const key in movie.info) {
if (key !== 'title') {
text = text + `${key}: ${movie.info[key]}`;
}
}
movieEl.textContent = text;
movieList.append(movieEl);
});
this is what i'm trying to get but it returns the function and not the data
const filterMovies = function filterMoviesHandler() {
if (!filter) {
movies
} else {
movies.filter((movie) => movie.info.title.includes(filter));
}
};
Top comments (0)