I have an array of integers. How can a determine a value's index depending on array, if I was to insert it into the array, so that no value before it is bigger.
Example:
let value = 3941;
calcOrder(value);
calcOrder(value) {
let array = [3002,2934, 1044, 2848, 1293, 9342, etc..]
// some logic
}
}
Result: According to this example, my function should return 5 ( cause 3941 < 9342 but more than other values in array ).
forloop with some basic math operations...[10000, 3002,2934, 1044, 2848, 1293, 9342, 1]?