Pass Parameters to Higher Order Functions - https://stackoverflow.com/a/7759286 Higher Order Functions - https://medium.freecodecamp.org/higher-order-functions-in-javascript-d9101f9cf528
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);