Tell us what’s happening:
what the array isnt sorting?
Your code so far
function getIndexToIns(arr, num) {
// Find my place in this sorted array.
arr.sort();
var i;
for ( i = 0; i < arr.length; i++) {
if (arr[i] >= num) {
return i;
}
}
return i;
}
getIndexToIns([5,3,20,3], 5);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/where-do-i-belong