I understand the basic idea of these two lines, but can someone explain the inner workings?
const byNolan = movie => movie.director === "Christopher Nolan";
const filter = (movies, func) => movies.filter(func);
const nolanMovieList = filter(movieList, byNolan);
Function byNolan
returns an array of movie objects directed by Christopher Nolan. When filter is called, its second paramter is the ‘byNolan’ function. When it filters, what are the criterias it is using? the filter
method returns an array of items that meet a certain criteria. So what kind of criteria is movies.filter(movieList, byNolan)
using. I hope the question makes sense.