What is the most efficient way to filter a list of strings character by character?
var term = "Mike";
angular.forEach($scope.contacts, function(contact, key) {
// if I had the whole term and
// contact.name == Mike then this is true
contact.name == term;
});
The above would be fine, but if I am building a search how can I filter character by character?
var term = "Mi";
angular.forEach($scope.contacts, function(contact, key) {
// contact.name == Mike, but term == Mi how can I get this to return true?
contact.name == term;
});