1function getIndexToIns(arr, num) {
2 return arr.filter(val => num > val).length;
3}
4
1function getIndexToIns(arr, num) {
2 arr.sort((a, b) => a - b);
3
4 for (let i = 0; i < arr.length; i++) {
5 if (arr[i] >= num)
6 return i;
7 }
8
9 return arr.length;
10}
11