It is possible but I would suggest you place these arrays as properties of an object, that makes it a lot easier
var arrays {
arr1 : [1,2,3],
arr2 : [4,5,6]
}
var arrNum = 2;
var arr = arrays["arr" + intNum] // arrays.arr2
Properties of objects can be accessed both using the .
operator and as named items using the ["propname"]
notation.
Using eval
or resorting to using the above trick on window
is not advised.
Eval'ing is normally a sign of ill constructed code, and using window relies on window being the Variable Object of the global scope - this is not part of any spec and will not necessarily work across browsers.