Implement custom Array.prototype.filter

Implement a custom myFilter function that works like the built-in Array.prototype.filter method.

Array.prototype.filter is a method that creates a new array with all elements that pass the test implemented by the provided function, e.g. filter all numbers greater than 3:

const numbers = [1, 2, 3, 4, 5];

const filtered = numbers.myFilter((number) => {
    return number > 3;
});

console.log(filtered); // Output: [4, 5]