控制台源选项卡显示代码中的拼写错误,但在文件中没有拼写错误

时间:2017-05-01 07:49:17

标签: javascript console google-chrome-devtools

所以我不断收到script.js:64 Uncaught SyntaxError: Invalid or unexpected token错误,即使我的代码中的第64行没有任何内容,但在Chrome的源代码选项卡中,在我的javascript文件中,我看到该行上的拼写错误 enter image description here

这是什么问题?我的代码:

function Question (theQuestion, theChoices, theCorrectAnswer) {
  this.question = theQuestion;
  this.choices = theChoices;
  this.correctAnswer = theCorrectAnswer;
  this.UserAnswer = "";
  var newDate = new Date();
  QUIZ_CREATED_DATE = newDate.toLocaleDateString();
  this.getQuizDate = function () {
        return QUIZ_CREATED_DATE;
    };
  console.log("Quiz Created On: " + this.getQuizDate());
}

Question.prototype.getCorrectAnswer = function () {
  return this.correctAnswer;
}

Question.prototype.getUserAnswer = function () {
  return this.UserAnswer;
}

Question.prototype.displayQuestion = function () {
  var questionToDisplay = "<div class='question'>" + this.question + "</div><ul>";
  choiceCounter = 0;

  this.choices.forEach(function (eachChoice) {
  questionToDisplay += '<li><input type="radio" name="choice" value="' + choiceCounter + '">' + eachChoice + '</li>';
    choiceCounter++;
  });
  questionToDisplay += "</ul>";
  console.log (questionToDisplay);
}

function MultipleChoiceQuestion (theQuestion, theChoices, theCorrectAnswer) {
  Question.call(this, theQuestion, theChoices, theCorrectAnswer);
  inheritPrototype(MultipleChoiceQuestion, Question);
}
​

allQuestions.forEach(function (eachQuestion)  {
    eachQuestion.displayQuestion();
});

clickBtn();

我尝试刷新缓存,但没有帮助。

0 个答案:

没有答案