看起来Chrome中存在错误。
尝试使用以下代码对对象数组进行排序时
var list = [
{Name: "Data1", pos: 35},
{Name: "dProduct", pos: 35},
{Name: "dSampleDeliveryDate", pos: 35},
{Name: "dAnalysisDate", pos: 35},
{Name: "dDestinationName", pos: 35},
{Name: "Data3", pos: 35},
{Name: "dRequirementRemarks", pos: 35},
{Name: "dAutoRemarks", pos: 35},
{Name: "dManualRemarks", pos: 35},
{Name: "Data13", pos: 35},
{Name: "dSignatures", pos: 35},
]
var sortFunc = function(a, b) {
return 0;
}
list.sort(sortFunc);
console.log(list);
由于sort函数返回0,结果应该是相同的列表,但是在log
中{Name: "Data3", pos: 35}
{Name: "Data1", pos: 35}
{Name: "dSampleDeliveryDate", pos: 35}
{Name: "dAnalysisDate", pos: 35}
{Name: "dDestinationName", pos: 35}
{Name: "dProduct", pos: 35}
{Name: "dRequirementRemarks", pos: 35}
{Name: "dAutoRemarks", pos: 35}
{Name: "dManualRemarks", pos: 35}
{Name: "Data13", pos: 35}
{Name: "dSignatures", pos: 35}
在所有其他浏览器中,结果都是正确的。