企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## sortedIndex + [link](./sortedIndex "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L6457 "View in source.") + [npm](https://www.npmjs.com/package/lodash.sortedindex "See the npm package.") ``` _.sortedIndex(array, value) ``` 使用二进制的方式检索来决定 value 应该插入在数组中位置。它的 index 应该尽可能的小以保证数组的排序。 ### 参数 1. array (Array) 需要检索的已排序数组 2. value (\*) 要评估位置的值 ### 返回值 (number) 返回 value 应该在数组中插入的 index。 ### 示例 ``` _.sortedIndex([30, 50], 40); // => 1 _.sortedIndex([4, 5], 4); // => 0 ```