Hello ) can not finish quiz , my function
function getIndexToIns(arr, num) {
// Find my place in this sorted array.
arr = arr.sort();
for (let i = 0; i < arr.length ; i++){
if (arr[i] >= num) {
console.log(arr[i]);
console.log(i);
return i;
} else if (arr.length == 0) {
console.log(0);
return 0;
}
}
}
getIndexToIns([5, 3, 20, 3], 5);
can not complite :
getIndexToIns([2, 5, 10], 15)should return
3` .
getIndexToIns([2, 5, 10], 15)
should return a number.
getIndexToIns([], 1)
should return 0
.
getIndexToIns([], 1)
should return a number.