Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js array .filter

// The filter() method creates a new array with all elements 
// that pass the test implemented

const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];

const result = words.filter(word => word.length > 6);

console.log(result);
// expected output: Array ["exuberant", "destruction", "present"]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #array
ADD COMMENT
Topic
Name
9+9 =