I need help with Private Eye!


#1

NEVER MIND I FIGURED IT OUT!

As mentioned, I have no requirement for help any longer!


#2

function StudentReport(grade1, grade2, grade3) {
this.grade1 = 4;
this.grade2 = 2;
this.grade3 = 1;
this.getGPA = function() {
var gpa = (this.grade1 + this.grade2 + this.grade3) / 3;
};
}

var myStudentReport = new StudentReport();

for(var x in myStudentReport) {
if(typeof myStudentReport[x] !== "function") {
console.log("Muahaha! " + myStudentReport[x]);
}
}

console.log("Your overall GPA is " + myStudentReport.getGPA());

This is my messed-up code,
also, can anyone tell me how to format my code stuff correctly in a post? I forgot...


#3

Neve mind I figured it out! :smile:


#4

....and the correct code is....?!!?!?


#5

You must change this.grade 1, this.grade2 and this.grade3 to
var grade1, var grade2, var grade3

This is right code:
function StudentReport() {
var grade1 = 4;
var grade2 = 2;
var grade3 = 1;
this.getGPA = function() {
return (grade1 + grade2 + grade3) / 3;
};
}