I'm not being able to get the $.each() jquery function working with string indexed arrays, any idea on whats wrong?
Example @ JSFiddle --> http://jsfiddle.net/WKDUA/
Code:
var firstArray = [52, 33];
document.writeln("First Array:\n<ul>");
$.each(firstArray, function(key, value)
{
document.writeln('<li>[' + key + ']: ' + value + "</li>\n");
});
document.writeln("</ul>\n");
var secondArray = new Array();
secondArray['first'] = 'foo';
secondArray['second'] = 'bar';
document.writeln("Second Array:\n<ul>");
$.each(secondArray, function(key, value)
{
document.writeln('<li>[' + key + ']: ' + value + "</li>\n");
});
document.writeln("</ul>\n");
Output:
First Array:
[0]: 52
[1]: 33
Second Array: