match = function(array, predicate) {
    for (let item of array) {
        if (predicate(item)) {
            return item;
        }
    }
    return undefined;
}
Returns the first element of an array matching the given predicate, or else returns undefined.