我正在使用以下脚本来迭代对象(我不知道哪个最好用,请告诉我哪个最好):
var days = {Sunday: 0, Monday: 1, Tuesday: 2, Wednesday: 3, Thursday: 4, Friday: 5, Saturday: 6};
$.each(days, function(key, value){
$('#days').append('<li>' + key + '(' + value + ')</li>');
});
for(var key in days){
$('#days').append('<li>' + key + '(' + days[key] + ')</li>');
}