« first day (2807 days earlier)      last day (1310 days later) » 

9:11 AM
 
 
3 hours later…
11:58 AM
the job of the function to add the number to the array, sort the array in ascending order and return the index of the added number here's my function function getIndexToIns(arr, num) {
arr = arr.sort();
for(let i in arr){
if(num < arr[i]){
arr.splice(i,0,num);

}
}
return arr.indexOf(num);
} and it works fine for argument lassed to it except for getIndexToIns([5, 3, 20, 3], 5) , getIndexToIns([], 1) and getIndexToIns([2, 5, 10], 15)
 
1 message moved from JavaScript
 
 
6 hours later…
6:05 PM
Nobody here?
 

« first day (2807 days earlier)      last day (1310 days later) »