I am trying to create a program that defines the variable finalResult
based on variable input
. The input
variable should call on an object inside of object A
:
var input = "";
var A = {
AA: {
result: 0
},
AB: {
result: 1
}
}
var finalResult = A.input.result;
So if input = "AA"
, then the final result should be 0, but if input = "AB"
, then the final result should be 1.