2
JavaScript新增功能。有人可以幫我理解爲什麼呼叫print()
返回undefined?Javascript類構造對象未定義
class Quizer {
constructor(quizObj) {
this.quiz = quizObj;
}
print() {
console.log(quiz.title);
}
};
var quizObjects = {
title: "Quiz1"
};
建設:
var quiz = new Quizer(quizObjects);
quiz.print(); //undefined
where is printAllQuestions()? –
我的錯誤是我的錯誤。我的意思是print(),而不是printAllQuestions() – blueman