[英]jQuery .each() not iterating over array of strings as expected
這樣做:
var tags = ["foobar", "hello", "world"];
$.each(tags, function(tag) {
console.log(tag);
});
給我一個輸出
0
1
2
為什么我的輸出沒有
foobar
hello
world
這樣做,第一個參數是索引:
$.each(tags, function(index, tag) {
console.log(tag);
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.