Skip to content
A small wrapper that implement the binary search algorithm in javascript
Find file
Latest commit 86f9bd0 @posabsolute small typo
Failed to load latest commit information.
array.js initial commit
index.html initial commit small typo
searchBinary.js initial commit
searchNormal.js initial commit

Binary search algorithm

With this little helper you just pass your array and what you are looking for and it will return you back a result array, a typical use would look like this:

var searchResult = searchBinary("m", array, true)
the parameters are : searchBinary(search string, array to search, case insensitive?)

This will return an array with all items starting by the letter m. A good use of this script would be with a auto-complete widget.

For more informations:

Something went wrong with that request. Please try again.