you can use console.log() at any place on your code for debugging, to make sure you reach a point in your code or not.
Please note, your loop never begins! This is becasue i starts from 0, and it’s never will be greater than array length, so I assume you got a typo/mistake by typing > instead of <
Another bug is when for loops ends! but there is no any respond after the loop!? considering getIndexToIns([2, 5, 10], 15) that you won’t find any place for the 15, so once the loop is finished, it should return 3. Go for it, fix it.