Update sortedIndex.md

This commit is contained in:
Angelos Chalaris
2017-12-31 17:05:50 +02:00
committed by GitHub
parent af1c42b77e
commit 2684f7aede

View File

@ -1,6 +1,9 @@
### sortedIndex ### sortedIndex
Returns the lowest index at which value should be inserted into array in order to maintain its sort order Returns the lowest index at which value should be inserted into array in order to maintain its sort order.
Check if the array is sorted in descending order (loosely).
Use `Array.findIndex()` to find the appropriate index where the element should be inserted.
```js ```js
const sortedIndex = (arr, n) => { const sortedIndex = (arr, n) => {