How do you search an array for a substring match?
If you’re able to use Underscore.js in your project, the _.filter() array function makes this a snap: // find all strings in array containing ‘thi’ var matches = _.filter( [ ‘item 1’, ‘thing’, ‘id-3-text’, ‘class’ ], function( s ) { return s.indexOf( ‘thi’ ) !== -1; } ); The iterator function can do whatever you … Read more