23. Private Variables



I don't know why is says ReferenceError: John is not defined. I do understand that I'm not supposed to be able to print John's bankBalance and I did try so this is confusing. Can someone please help me? I don't know if I need to add something or take something out.

function Person(first,last,age) {
   this.firstname = first;
   this.lastname = last;
   this.age = age;
   var bankBalance = 7500;

// create your Person 
var john = new Person('John','Ross',61);
var myFirst = john.firstName;
var myLast = john.lastName;

// try to print his bankBalance


The above lines are not asked for, so don't create them. Only give what is asked for and these lessons will be easier to pass.


As the error reads, John is not defined. john is, but this still does not match the instructions.


This is deliberate, on the part of the author. It is supposed to raise an error, so expect it.


Thank you so much. Sometimes a second set of eyes is all it takes.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.