Hi there. I can’t figure out where I’m going wrong?? Please help

```
function getIndexToIns(arr, num) {
// Find my place in this sorted array.
arr = arr.sort(function(a, b){return a-b;});
var answer = 0;
for (var i=0; i<arr.length; i++) {
if (num<=arr[i]) {
answer = arr.indexOf(arr[i]);
}
}
return answer;
}
getIndexToIns([10, 20, 30, 40, 50], 30);
```