顯然IE8具有獲得附加到從呼叫所得陣列String.prototype.match()
三個屬性:使用茉莉比較陣列失敗在IE8
input
,index
和lastIndex
的結果是當使用Jasmine's .toEqual()
匹配器時,數組比較失敗。
我仍然在單元測試的學習曲線上工作,所以我只是好奇正確的方法來處理這個失敗。
下面的作品,但似乎有點跛:
numArray = str.match(/\d+(\.\d+)?/g);
if (numArray && numArray.input) {
delete numArray.index;
delete numArray.input;
delete numArray.lastIndex;
}