Last active
September 23, 2016 15:45
-
-
Save jgresalfi/06d062aa7ee00f4422641940e7692947 to your computer and use it in GitHub Desktop.
Return lowest possible index position of second argument after it is added to the first arg's array and sorted...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getIndexToIns(arr, num) { | |
let numArr = arguments[0], | |
addNum = arguments[1]; | |
numArr.push(addNum); | |
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