看不太懂啊,谁能详细解释哈子
var Enumerable = {
each: function(iterator) {
var index = 0;
try {
this._each(function(value) {
try {
iterator(value, index++);
} catch (e) {
if (e != $continue) throw e;
}
});
} catch (e) {
if (e != $break) throw e;
}
},
从哪里可以看出
每个元素都执行一次,在执行过程中,如果遇一到符合条件的元素,终止程序???
all: function(iterator) {
var result = true;
this.each(function(value, index) {
result = result && !!(iterator || Prototype.K)(value, index);
if (!result) throw $break;
});
return result;
},
上面这个方法怎么调用的each
each里面的function()是什么意思