23. private Variables


I do not understand why it passes..its not making any sense. Cause my output is not relevant


Start next new lesson.

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","Sauls",21) 

// try to print his bankBalance


HI you try to access a private variable so it normal that you get that output on next lesson they wil teach you how to access it .


Hello @devninja93146,

The reason this exercise exists is to show you that in javascript, inside object constructors, you can make "private" variables that cannot be accessed by the rest of the code...


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