Accessing class variable with string name?

Posted by coure06 on Stack Overflow See other posts from Stack Overflow or by coure06
Published on 2010-04-19T20:39:21Z Indexed on 2010/04/19 20:43 UTC
Read the original article Hit count: 122

Filed under:
|

I have a class like this
$.fn.dimeBar = function(custom) {
var var1 = 'test1';
var var2 = 'test2';
if(sometest){
//how can i access var1 or var2 here by using string name of variables
//some thing like alert(this['var1']) --> should alert: 'test1'
}
}

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript