Hi,

the last couple algorithms have been challenging to say the least and I had to look at the solution. I don’t want to do that with this one, so can someone please point me in the right direction without actually telling me the solution?

The problem is that indexOf() is not returning what I want.

Here’s my code:

```
function getIndexToIns(arr, num) {
function compareNumbers(a, b){
return a - b;
}
arr.sort(compareNumbers);
for (var n = 0; n < arr.length; n++) {
if(arr[n] > num && num < arr[n]+1){
return arr.indexOf(arr[n])-1;
}
else if (num === arr[n] || num < arr[n]){
return 0;
}
}
}
getIndexToIns([40, 60], 50);
```

Thanks in advance!