Search an array return partial matches
问题 I need to search an associative array's values for a string, but only the beginning of the string example: var stack = ['aba', 'abcd', 'ab', 'da', 'da']; a search on stack for the value a would return ['abc, 'abcd', 'ab'] , and for b would just return b while a search for 'd' would return [da', 'da'] ...any way to do that? Im trying to do like an autocomplete select box, but its custom so i need to moditor text events and search my array of items to get the index of the first match while the