What do you think of my solution? I just wanted to make sure I had the right idea of solving it.
function getIndexToIns(arr, num) {
arr.sort(function(a,b){
return a-b;
});
arr.push(num);
function finditsplace(x){
return x >= num;
}
return arr.findIndex(finditsplace);
}
getIndexToIns([3, 10, 5], 3);//0