we have already an implementation of the binarySearch algorithm in utilities/binary_search.js. I would suggest to try to use that component instead of duplicating.