Skip to content

Instantly share code, notes, and snippets.



Last active Sep 23, 2016
What would you like to do?
Return lowest possible index position of second argument after it is added to the first arg's array and sorted...
function getIndexToIns(arr, num) {
let numArr = arguments[0],
addNum = arguments[1];
numArr.sort(function(a, b) {
return a - b;
return numArr.indexOf(addNum);
getIndexToIns([40, 60], 70);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment