Can someone explain 30. Private Eye please


#1

I do not understand the instructions that it is giving me. it just make any sense to me. Could someone please help I will very much appreciate it if you did.


#2

Could you provide a link to the lesson and/or the instructions?


#3

Modify the StudentReport class so that no grades will be printed to the console in the for-in loop.

However, getGPA should still function properly in the last line.

function StudentReport() {
this.grade1 = 4;
this.grade2 = 2;
this.grade3 = 1;
this.getGPA = function() {
return (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());
Here you go.


#4

Just completed #30, they want you to modify the StudentReport() function so that only the last line of code; console.log("Your overall GPA is " + myStudentReport.getGPA()); gets loged to the console.

I'm not going to say too much! Try and figure it out!


#5

here is that you have to write in:
look that you make variables private removing this. and writing var
then you remove this. whitin return( ), because variables are not public now.
I hope this help someone!!

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


#6

change this to var both place..inside getGPA method as well

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