I have small problem. I have script that has many arrays.
My previous function returns a "chosen" variable which is a parameter of my setBreakValues
function it's also the name of array i want to access values of in my function. Lets say i get "test" return from my other function and pass it into setBreakValues
i want to access test[0]
element in test array but it returns the first letter of parameter. I just simply want to use it as a name of array. Is that possible?
Here is the broken code:
function setBreakValues(chosen){
console.log(chosen[0][1])
$("#totalTime").val($("#firstTime").val())
var select = document.getElementById('breakValue');
for(var i = 0; i < chosen.length; i++) {
var option = document.createElement('option');
option.innerHTML = chosen[i][0];
option.value = chosen[i][0];
select.appendChild(option);
}
$("#breakValue").change(function(){
$("#secondPressure").val(chosen[0][1])
})
}