im practicing javascript .
and im trying using array element as array name in Javascript .
i searchd stackoverflow and found some links like this
when im testing this i found that its not working, it gives undefind when im calling the second function. please see the jsbin link , maybe im getting it wrong please help me out. here is my code , and link: https://jsbin.com/yazowutera/
<button onclick="testArrays1(a, [vic.zero, vic.one])">source</button>
<br>
<button onclick="testArrays2(a, vic[all[1]])">desti</button>
and javascript
<script>
var vic = {
zero : ["00","01","02"],
one : ["10","11","12"],
two : ["20","21","22"]
};
var all = ["zero","one","two"];
var a = "a";
function testArrays1(needle, arrays){
for (var i=0; i<arrays.length; i++) {
alert(needle +arrays[i]);
}
}
function testArrays2(needle, arrays) {
//for (var i=0; i<arrays.length; i++) {
alert(needle +arrays);
//}
}
</script>
im not in j-query right now please ans in javascript