Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Filter and map an array

const filteredList = watchList
  .filter(movie => {
    // return true it will keep the item
    // return false it will reject the item
    return parseFloat(movie.imdbRating) >= 8.0;
  })
  .map(movie => {
    return {
      title: movie.Title,
      rating: movie.imdbRating
    };
  });
Source by forum.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #Filter #map #array
ADD COMMENT
Topic
Name
2+9 =