これはラインである:Internet Explorer 8で.filter()が動作しないのはなぜですか?
songs = songs.filter(function (el) {
return el.album==album;
});
これはエラーです:
Object doesn't support this property or method
これは、Chromeで100%の罰金を動作します。どうしたの?
if (!Array.prototype.filter)
{
Array.prototype.filter = function(fun /*, thisp */)
{
"use strict";
if (this === void 0 || this === null)
throw new TypeError();
var t = Object(this);
var len = t.length >>> 0;
if (typeof fun !== "function")
throw new TypeError();
var res = [];
var thisp = arguments[1];
for (var i = 0; i < len; i++)
{
if (i in t)
{
var val = t[i]; // in case fun mutates this
if (fun.call(thisp, val, i, t))
res.push(val);
}
}
return res;
};
}
から:https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/filter
それとも、jQueryのを使用しているので、あなたができる
私はポールのを見て前に、私は私の答えを投稿しました。曲は配列かjQueryオブジェクトですか? – Dennis