工作,我有一個數組,我需要使用分別關於該項目,但和的forEach $。每個不工作的陣列這裏exmple(jsfiddle)
var person = new Array();
person["firstName"] = "John";
person["lastName"] = "Doe";
person["age"] = 46;
jQuery.each(person, function(index, item) {
alert(index + " : " + item);
});
我建議閱讀MDN JavaScript指南:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects –