23. Private Variables


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

// create your Person
var john = Person("John", "Son", 36);

// try to print his bankBalance

This is my code, but the page says: "Oops, try again. Make sure to create john using the Person constructor". What's wrong in my code?


Use 'new' keyword to create an object.
var john = new Person("John", "Son", 36);


Thanks! I missed that part :frowning:


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