Issue with "where I belong"

I have working code for the “where I belong” algorithm in the “basic Algorithm Scripting” sectioon, but for some reason everything is tested as incorrect. Here’s my code:
function getIndexToIns(arr, num) {
console.log(“unsorted:” + arr);
var sorted = arr.sort(compareNumbers);
console.log(“sorted: “);
console.log(sorted);
var i = 0;
console.log(“num:” + num);
for (i in sorted) {
console.log(i + “:” + sorted[i]);
// console.log();
if (num <= sorted[i]) {
console.log(“found:” + i);
console.log(”-------------------”);
return i;
}

}
console.log("-----------------");
return i;
}

function compareNumbers(a, b) {
return a - b;
}
getIndexToIns([40, 60], 0);

here’s my console output:

the fcc console will say “xxxx should return y”, and I run my code, and it does return the correct result. not sure what’s wrong here, am I missing something?

NEVERMIND! it asks for numbers to be returned, and it was returning i as a string. just threw in a Number(i) where the i’s were and it worked!