I get the error wrappedCompareFn is not a function. What kind of error is this?

Here is my code:

```
function getIndexToIns(arr, num){
// Find my place in this sorted array.
var indexNumber;
arr.sort(arr);
arr.sort(function(){
for(var x=0;x<arr.length;x++){
if(arr[x]==num){
indexNumber=arr[x].indexOf([x]);
}
else if(arr[x].indexOf([x])>num && arr[x+1].indexOf([x])<num){
indexNumber=Math.round(num);
indexNumber=arr.indexOf(x+1);
}
else{
indexNumber=Math.round(num);
}
}
});
return indexNumber;
}
getIndexToIns([40, 60], 50);
```