25. Private Methods, problem with syntax


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

var returnBalance = function() {
return bankBalance;
};

// create the new function here
this.askTeller = function() {
return returnBalance;
};

var john = new Person('John','Smith',30);
console.log(john.returnBalance);
var myBalanceMethod = john.askTeller();
var myBalance = myBalanceMethod();
console.log(myBalance);

"Oops, try again. There was a problem with your syntax."

Unsure of what is wrong here?


#2

Move that down to after return bankBalance; like so,

    var returnBalance = function() {
        return bankBalance;
    }
};

#3

@mtf
Okay so I did that and now I get this error:
"Oops, try again. Make sure you properly defined the askTeller method!"


#4

I'm getting dumber with age.

    var returnBalance: function() {
        return bankBalance;
    },
    
    // create the new function here
    this.askTeller: function() {
       return returnBalance;
    }
};

#5

Thankyou!!!!! :blush: