Huba buba 2 26/30


#1

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

this.askTeller = function(pass) {
if (pass == 1234) return bankBalance;
else return "Wrong password.";
};
}

var john = new Person('John','Smith',30);
/* the variable myBalance should access askTeller()
with a password as an argument */
var myBalance = bankBalance.function(1234);

what am I doing wrong?


#2

bankBalance.function(1234);

the "function" isn't a value, it's a method, try using the value name that you assigned to that function "askTeller" instead of "function" and that should pass your code!


#3

instead of :-
var myBalance = bankBalance.function(1234);
try:-
var myBalance = john.function(1234);