iSaumya iSaumya - 1 month ago 5x
Javascript Question

calling array names dynamically inside jquery

I'm pretty sure this question is going to get negative response as many people have already asked it in SO. But trust me I have read every single answer of every single question none helped.

I know that in jquery you can put the array key name dynamically like this:

somearray1["abc" + variable]
but I'm not looking for that. I want to call the array name dynamically like:

var i=1;
console.log( "somearray" + i["abc" + variable] )

Can someone tell me how is it possible? I cannot put it in another array and call that as I'm building a very dynamic script, so I must need to call the array name dynamically.

Any help will be highly appreciated.


Normaly, your array depend from this.

this["somearray" + i]["abc" + variable]

var bob1 = [1,2,3];
var name = "bob";