Given
var input[[]];
$('some_selector').each(function() {
var outer, inner;
outer=$(this).parent().attr('some_property');
inner=$(this).attr('a_property');
input[outer].push(inner);
});
An error is encountered during the push
function. Is it because the specific input[outer]
is not declared as array?
Also, the value of outer
is not necessarily sorted. So within the loop, outer
can sequentially have values of: "property1","property2","property1","property3","property2"...
In PHP terms, is there something equivalent to:
foreach () {
$input[$outer][]=$inner;
}
Thanks!