Private variable,after execute it says undefined


#1



function Person(first,last,age) {
   this.firstname = first;
   this.lastname = last;
   this.age = age;
   var bankBalance = 7500;
}
var john = new Person('Sudeep', 'sagar', 22)
// create your Person 
var myFirst = john.fisrt;
var myLast = john.lastName;
var myAge = john.age;

console.log(Person.bankBalance);


#2

Hi it's not a error it's right that it says undefined because it's a private variable on the next lesson you will learn how to print a private variable


#3

yeah. I got it :slight_smile: