这太简单了,我很困惑。我有以下几点:JavaScript Array迭代返回的值超过
var x = 'shrimp';
var stypes = new Array('shrimp', 'crabs', 'oysters', 'fin_fish', 'crawfish', 'alligator');
for (t in stypes) {
if (stypes[t] != x) {
alert(stypes[t]);
}
}
一旦值已经迭代它开始返回十几功能,如
function (iterator, context) {
var index = 0;
iterator = iterator.bind(context);
try {
this._each(function (value) {iterator(value, index++);});
} catch (e) {
if (e != $break) {
throw e;
}
}
return this;
}
究竟发生了什么事?
编辑:在这些脚本中,我使用http://script.aculo.us/prototype.js和http://script.aculo.us/scriptaculous.js我记得现在阅读原型扩展数组的方式,我打赌这是它的一部分。我如何处理它?
我只是想说......代码对我来说工作得很好,某些东西必须有不同的原型。我会跟Quintin的回答一起去的。 – womp 2009-09-29 23:26:25