1 2 3 4 | var fruit = ['apple', 'banana', 'orange']; for(var i = 0; i < fruit.length; i++) { alert(fruit); } |
1 2 3 | ['apple', 'banana', 'orange'].each(function(item) { alert(item); }); |
1 2 3 4 | var hash = new Hash({name: "Joe Lennon", email: "joe@joelennon.ie"}); hash.each(function(value, key) { alert(key + ": " + value); }); |
1 2 3 4 | var hash = $H({name: "Joe Lennon", email: "joe@joelennon.ie"}); hash.each(function(pair) { alert(pair.key + ": " + pair.value); }); |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |