私は次の実装を使用しています
if (!('forEach' in Array.prototype)) {
Array.prototype.forEach= function(action, that /*opt*/) {
for (var i= 0, n= this.length; i<n; i++)
if (i in this)
action.call(that, this[i], i, this);
};
}
if (!('filter' in Array.prototype)) {
Array.prototype.filter= function(filter, that /*opt*/) {
var other= [], v;
for (var i=0, n= this.length; i<n; i++)
if (i in this && filter.call(that, v= this[i], i, this))
other.push(v);
return other;
};
}
しかし、私が for ループを使用している場合、その動作は奇妙なものです
var conditionJSONObject=new Array();
var conditionCombiner=new Array();
var combiner ;
combiner = jQuery.trim(jQuery(conditionTable.rows[i+1].cells[4].children[0]).select().val());
for(var index in conditionJSONObject)
{
if(conditionCombiner[index].combiner.toUpperCase() == 'AND')
{/*Some code of mine*/}
}
このコードはエラーを返しますが、最初は正常に動作していましたが、FF でも同じコードが正常に動作します。