param { number [ ] } nums param { number } target function BinarySearch ( nums , target ) { let low = 0 ; let high = nums . length - 1 ; let mid = 0 ; while ( low <= high ) { mid = low + Math . floor ( ( high - low ) / 2 ) ; if ( target === nums [ mid ] ) { return mid ; } else if ( target > nums [ mid ] ) { low = mid + 1 ; } else { high = mid - 1 ; } } return - 1 ; } export { BinarySearch } ;