I have an array with anonymous elements. Elements are added to the array via php, like so:
$playlist = array();
while (databaseloop) {
$playlist[] = $a_ti
Well, maybe this is the most basic solution:
for (var i = 0; i < arr.length; i += 2) {
var title = arr[i];
var len = arr[i+1];
}
However, I would recommend you to arrange $playlist
as follows:
while (databaseloop) {
$playlist[] = array(
"title" => $a_title,
"length" => $a_length
);
}
Then it will be easy to iterate the elements simply with:
for (var i = 0; i < arr.length; i++) {
var title = arr[i]['title'];
var len = arr[i]['length'];
}