Junior — Senior
Creating your own filter method equivalent
livecode
Task condition
Implement the function myFilter, which will work the same way as the built-in Array.prototype.filter. After adding it to an array, calling myFilter should return the same result as the original filter.
const source = [1, 2, 3, 4, 5, 6];
const expected = source.filter(item => item % 2);
const actual = source.myFilter(item => item % 2);
console.log(expected);
// console.log(actual);