Where do I belong (2 tests fail)

Tell us what’s happening:

The challenge fail me on 2 tests:
getIndexToIns([5, 3, 20, 3], 5) should return 2.
getIndexToIns([2, 20, 10], 19) should return 2.
I tried copying the code in a console and run it, and it returns what is expected in the test. And weird enough is that other tests pass. I can’t see what the output the tests see.

Can some one help to take a look at my code? If that’s alright, how should I debug why the tests are unhappy?

Your code so far

function getIndexToIns(arr, num) {
  arr.sort((a, b) => a > b);
  var minIndex = 0;
  for (var i = 0; i < arr.length; ++i) {
    if (arr[i] < num) {
      minIndex = i + 1;
    } else {
  return minIndex;

getIndexToIns([40, 60], 50);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8.

Link to the challenge:

I am not seeing any problem with your code. In fact in passes the tests when I run your code. Try clicking Run Tests again and /or refresh the page and try again.

Thanks! Interesting. So I copied my code to Firefox, and now it worked (was using Safari/PrivateBrowsing). My guess is that FCC may use localStorage somehow for this challenge – I do see quite a few quota exceeded errors in the browser console, which is expected when using localStorage in Safari’s Private Browsing.