fazlurr
8/25/2017 - 3:29 AM

Pass Parameters to Higher Order Functions - https://stackoverflow.com/a/7759286 Higher Order Functions - https://medium.freecodecamp.org/hig

const someArray = ['this', 'is', 'array'];

function startsWith(wordToCompare) {
    return function(element) {
        return element.indexOf(wordToCompare) === 0;
    }
}

const filtered = someArray.filter(startsWith('t'));

console.log(filtered);