arrays - Reference a value in JavaScript -
this question has answer here:
i have couple of check boxes i'd use "name" attribute value reference within array.
let's have array so:
var test = { "one" : 1, "two" : 2, } var somebtn = "one";
how can following?
test.somebtn; // translate test.one
obviously, test.somebtn not work. possible?
just refer if array:
test[somebtn]
Comments
Post a Comment