Underscore.js Arrays: SortedIndex

by tylerbrownhenry

HTML

<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<a target="parent" href="http://underscorejs.org/#sortedIndex">Learn More</a>

JavaScript

var sortedIndex = _.sortedIndex([10, 20, 30, 40, 50], 35);
console.log(sortedIndex);
//3, the index at which 35 should be placed