Why isn’t "for in " working in that challenge ???
function getIndexToIns(arr, num) {
... sort the array
for(let i in sortedArr){//for in not working... any explanation ???
if(sortedArr[i] >= num){
return i
}
}
... rest of the code
}
let x = getIndexToIns([10, 20, 30, 40, 50], 35);
console.log(x)
Basic Algorithm Scripting: Where do I Belong | freeCodeCamp.org