Sortedindex

_.sortedIndex(array, value)

Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order.

Arguments

array (Array): The sorted array to inspect.
value (*): The value to evaluate.

Returns

(number): Returns the index at which value should be inserted into array.

Example

Deep

mid = (low + high) >>> 1;
二分查找 使用無符號右移運算符(>>>)將結果除以2並向下取整

無符號右移算符(>>>