Sobes.tech
Junior — Senior

Independent implementation of the filter function

livecode

Task condition

It is necessary to write a custom version of the filter function that takes an array and a predicate function, returning a new array containing only those elements for which the predicate returned true. When implementing, it should be considered that the original array must not be modified, and the predicate can accept one, two, or three arguments (element, index, original array).