正在进行:
var tags = ["foobar", "hello", "world"];
$.each(tags, function(tag) {
console.log(tag);
});
给我一个输出结果
0
1
2
为什么我的输出不正确
foobar
hello
world
正在进行:
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);
});
console.log(tags[tag]);
- dunli