olivia-xia

filter() 方法创建一个新数组, 其包含通过所提供函数实现的测试的所有元素。

语法:var new_array = arr.filter(callback(element[, index[, array]])[, thisArg])

1 var words = [\'spray\', \'limit\', \'elite\', \'exuberant\', \'destruction\', \'present\'];
2 
3 const result = words.filter(word => word.length > 6);
4 
5 console.log(result);
6 // expected output: Array ["exuberant", "destruction", "present"]

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2021-11-23
  • 2022-12-23
  • 2021-10-24
  • 2022-12-23
相关资源
相似解决方案