Hi all,
I’ve written up this code for this challenge and it passes most of the tests except for when this is entered into the function.
getIndexToIns([], 1)
should return0
.
Here’s my code so far.
Your code
function getIndexToIns(arr, num) {
let sortNumber = (a, b) => a - b;
return arr.sort(sortNumber).findIndex(arr => arr >= num);
}
console.log(getIndexToIns([], 1));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
.
Link to the challenge:
Can anyone help explain to me where it’s going wrong?