arrays - Reference a value in JavaScript -


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

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

php - Boolean search on database with 5 million rows, very slow -

css - Text drops down with smaller window -