同一文本文档在chrome浏览器中可以很好地加载,但在Internet Explorer中只能加载第一行。
这是文本文件
这是代码,我将内容加载到pre标签中,如下所示。
const array1 = [
{dayOfWeek: 2, home1: "01:30"},
{dayOfWeek: 3, home1: "02:30"},
{dayOfWeek: 4, home1: "03:30"},
{dayOfWeek: 5, home1: "04:30"},
];
const array2 = [
{dayOfWeek: 3, home1: "05:30"},
{dayOfWeek: 4, home1: "06:30"},
{dayOfWeek: 5, home1: "07:30"},
{dayOfWeek: 6, home1: "08:30"},
];
function getFinalArray(array, uniqueProperty) {
return array
.filter(value => value)
.reduce(
(arrayMap, item) => {
return arrayMap.set(item[uniqueProperty], item)
}, new Map()
);
}
const result = Array.from(
getFinalArray([...array2, ...array1], 'dayOfWeek').values()
);
但是在Internet Explorer中,它显示如下
在chrome中效果很好
注意:图像中的红点表示/ u0。如何从文本内容中删除它?