arrayFilter

arrayFilter(array array, function callback) → array newArray
Returns a new array containing all (key, value) pairs from the source array for which the callback function returned true. If the callback function takes one parameter, it is the source array's value that is sent; if it takes two parameters, the first is the key and the second is the value.

Returns a new list containing all the values of the source list array for which the callback function returned a value equivalent to true.

The callback function takes 1 to 3 parameters, in this order: (value, position, source list).

Example:

var array = [1, 2, 3, 4, 5]
var result = arrayFilter(array, function(v) {
    return v % 2 == 0
}) // [2, 4]
const array = [1, 2, 3, 4, 5]
const result = array.filter(v => v % 2 === 0) // [2, 4]
array = [1, 2, 3, 4, 5]
result = [v for v in array if v % 2 == 0]  # [2, 4]
Parameters
Return
Note