我不知道为什么会收到“ Uncaught TypeError:无法读取null的属性'map'”

时间:2019-11-15 08:04:21

标签: reactjs typeerror

我遇到错误

  

未捕获的TypeError:无法读取null的属性“ map”

var highScoresList = document.getElementById("highScoresList");
var highScores = JSON.parse(localStorage.getItem("highScores")) || [];


highScoresList.innerHTML = highScores
  .map(score => {
    return `<li class="high-score>${score.name}-${score.score}</li>`;
  })
  .join("");

0 个答案:

没有答案