Private Methods


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

var returnBalance = function() {
return bankBalance;

this.askTeller = function() {
return returnBalance;


var john = new Person(‘John’,‘Smith’,30);
var myBalanceMethod = john.askTeller();
var myBalance = myBalanceMethod();

It returns: It looks like myBalance doesn’t have the correct value! Make sure that askTeller returns the method itself and that you have not modified the provided code. I have not changed anything with the provided code. What am I doing wrong?


Instance objects do not have a returnBalance attribute. It is a static (private) method accessible only to the class, itself. If this is in the instructions, it is to demonstrate that an error will be raised.

To show that the askTeller method returns another method, test it with,



Got it. Thanks a lot!


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