I trying declare an array, push colection of arrays and iterate colection
My JS:
var colection = [];
var array = ["a1", "a2"];
colection.push(array);
array = ["b1", "b2"];
colection.push(array);
$.each(colection, function(array){
var p = "<p>1:"+array[0] +
"<br>2:"+array[1]+"</p>";
$("#test").append(p);
});
my html:
<div id="test">
</div>
I want that result:
1:a1
2:a2
1:b1
2:b2
but return only:
1:undefined
2:undefined
1:undefined
2:undefined