I want to compare each string in an Array with a given string. My current implementation is:
function startsWith(element) { return element.indexOf(wordTo
function startsWith(element, wordToCompare) { return element.indexOf(wordToCompare) === 0; } // ... var word = "SOMETHING"; addressBook.filter(function(element){ return startsWith(element, word); });