文本文档仅在Internet Explorer的预标签中加载第一行

时间:2018-11-23 08:24:09

标签: javascript html css google-chrome internet-explorer

同一文本文档在chrome浏览器中可以很好地加载,但在Internet Explorer中只能加载第一行。

这是文本文件

enter image description here

这是代码,我将内容加载到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中,它显示如下

enter image description here

在chrome中效果很好

enter image description here

注意:图像中的红点表示/ u0。如何从文本内容中删除它?

0 个答案:

没有答案