loading
open in
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var s = [23, 65, 98, 5];

Array.prototype.myFilter = function(callback){
  var newArray = [];
  // Add your code below this line 
  this.forEach(i => {
    if(callback(i)) {newArray.push(i)
    }
     });

  return newArray;
  }
  // Add your code above this line


var new_s = s.myFilter(function(item){
  return item % 2 === 1;
});
Native Browser JavaScript