개발

[Javascript] trick! convert string to variable name

팥빙구 2015. 2. 18. 00:45

Use Javascript window[]



example)


var a1 = "binibin"

> undefined

window["a"+"1"]

> "binibin"