https://www.freecodecamp.com/challenges/where-do-i-belong
I tried passing all the test cases and the output are supposed to be accepted but...
function getIndexToIns(arr, num) {
// Find my place in this sorted array.
arr.push(num);
arr.sort(function(a, b){
return a - b;
});
for(var i in arr){
if(arr[i] == num){
return i;
}
}
}
getIndexToIns([2, 20, 10], 19);

@wanmi59 the type of the return statement should be an integer, not a string, so that is why the tests are failing. If you get stuck with a challenge, please first ask questions to the Help Room.
However, I do propose rewriting the instructions to be more clear:
Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted. The returned value should be a number.
cc/ @FreeCodeCamp/issue-moderators
@erictleung, sounds good to me!
Those wanting to fix this, this line needs to be changed to:
Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted. The returned value should be a number.
Please first read the contributing guidelines before taking care of this issue. And feel free to visit the Contributors Help chat room if you have any questions about helping. We're there to help.
Can I take this?
@JonW27 go for it!