I do not understand why my code wont work.

It appears to do the same thing as the solution given in the hint.

**Your code so far**

```
function getIndexToIns(arr, num) {
var varArray = arr;
var sArray = varArray.sort(function(a, b){return a-b});
var varIndex = 0;
for (var i = 0; i < sArray.length; i++){
if (sArray[i] >= num){
varIndex = i;
}
}
return varIndex;
}
getIndexToIns([40, 60], 50);
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36`

.

**Challenge:** Where do I Belong

**Link to the challenge:**

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/where-do-i-belong