This code doesn't print out bankBlance what is wrong?


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 = john.askTeller(1234)


Well, why would your code print that? What would cause something to be printed? How does one print something? Do you have that something?


you should use console.log(); to get something printed. :smile: