+ 2
Can anyone say why this error occurred?
var Question = function(question, answers, correct) { this.question = 'question'; this.answers = 'answers'; this.correct = 'correct'; } Question.prototype.displayQuestion() { console.log(this.question) }
2 Answers
+ 1
anyonr
0
Let me know if this is what you are trying to get at.
var Question = function(question,answer,correct) {
this.question = question;
this.answer = answer;
this. correct = correct;
}
var question1 = new Question("Is the sky blue","Yes");
Question.prototype.displayQuestion = this. Question;
console.log(question1);