# binarySearch

engine/Source/Core/binarySearch.js 24
Finds an item in a sorted array.

##### Example:

    // Create a comparator function to search through an array of numbers.
    function comparator(a, b) {
        return a - b;
    };
    const numbers = [0, 2, 4, 6, 8];
    const index = Cesium.binarySearch(numbers, 6, comparator); // 3

Need help? The fastest way to get answers is from the community and team on the Cesium Forum.