I am currently working on a function that needs to choose a specific array based on the button that triggers it.
For instance:
If a button with id="Anterior"
activates the function, it should select the array named plusAnterior
:
var plusAnterior = ["p", "b", "t", "d", "ɸ", "β", "f", "v", "θ", "ð", "s", "z", "m", "n", "l", "ɬ", "r", "ɾ"];
var minusAnterior = ["c", "ɟ", "k", "g", "ʃ", "ʒ", "x", "ɣ", "ɲ", "ŋ", "j", "w", "ʡ", "h"];
var toAdd = [];
function addFeature(featureId) {
if (activeFeatures === 0) {
toAdd = // plusAnterior selected here
}
}
The issue I'm facing is that I need the function to be flexible enough to work with any button press. I considered using something like
getElementById("plus" + featureId)
, but I can't since the arrays are not defined in my HTML document.
Your assistance will be greatly appreciated.