Is it possible to use varName1[varName2] to retrieve a value from an array. In the example below, .el is a select box, thisVal might = 2 and thisName = 'B' which should result in the answer 'U' in fact I am getting undefined
<script>
var A = ['B','B','Z','Z']
var B = ['C','O','U','C2','C3','D']
var C = ['D','Z','D','Z']
$('.el').on('change', function() {
var thisVal = this.value
var thisName = this.name
var nextName = thisName[thisVal]
alert( nextName );
})
</script>