<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@essex/toolbox](./toolbox.md) &gt; [binarySearch](./toolbox.binarysearch.md)

## binarySearch() function

Performs a binary search on the given array

<b>Signature:</b>

```typescript
export declare function binarySearch<T = number>(array: T[], item: T, compare?: typeof DEFAULT_COMPARE): number;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  array | T\[\] | The array of numbers to search |
|  item | T | The item to look for |
|  compare | typeof DEFAULT\_COMPARE | <i>(Optional)</i> |

<b>Returns:</b>

number

index of found item

