📜  js 数组 .filter - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:27.778000             🧑  作者: Mango

代码示例1
// 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"]