Passing Arguments


#1


Oops, try again. Make sure to set myBalance equal to calling john's askTeller method with 1234 as the argument

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');

So many refreshes, but it didn't worked!


#2

Try

var myBalance = john.askTeller(1234);

#3

good catch, the pincode should be represented as integer, not as string


#4

I think that

var myBalance = john.askTeller('1234');

also should works because for checking password was used ==:

if (pass == 1234) return bankBalance;

#5

from a technical point of view, yes, but it seems the validation wants the passcode as integer.


#6

Oh gosh. I didn't think about it
Thanks guys.


#7