I'm in the process of developing a JavaScript function that takes a value passed from a servlet, then searches an array to find the index of that value. The loop will then start at that index and continue until it reaches the last value of the array, at which point it will restart from the beginning of the array. Below is the code for my function:
function Calculate(servletValue){
var calculateArray = [0.000001, 0.000003, 0.00001, 0.00003, 0.0001, 0.0003, 0.001, 0.003, 0.01, 0.03, 0.1, 0.3];
var index = calculateArray.indexOf(servletValue);
for(i = 0; i<calculateArray.length; i++){
console.log(calculateArray[i]);
}
}
Thank you in advance for any assistance!