showing results for - "filter javascript"
Isabella
23 Mar 2018
1ngOnInit() {
2  this.booksByStoreID = this.books.filter(
3          book => book.store_id === this.store.id);
4}
Marvin
15 Jul 2016
1var words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
2
3const result = words.filter(word => word.length > 6);
4
5console.log(result);
Liah
18 Sep 2020
1const arr = [1, 2, 3, 4, 5, 6];
2const filtered = arr.filter(el => el === 2 || el === 4);	//[2, 4]
Serena
23 May 2016
1arrayName.filter(item => item.value ==='value here' )
Luigi
06 Jan 2021
1const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];
2
3const filter = arr.filter((number) => number > 5);
4console.log(filter); // [6, 7, 8, 9]
5
6or 
7
8const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
9
10const result = words.filter(word => word.length > 6);
11
12console.log(result);
13// expected output: Array ["exuberant", "destruction", "present"]
Loucas
06 Apr 2018
1function filter(array, filterfunc) {
2
3  let filteredArray = [];
4  for (let i = 0; i < array.length; i++) {
5    let result = filterfunc(array[i], i, array);
6    if (result) {
7      filteredArray.push(array[i]);
8    }
9  }
10  return filteredArray;
11};
12
similar questions
queries leading to this page
filter javascript