26. Pa ssing Arguments (says title has censored word in it thats why there is a space)


pls help me

says i have syntax error

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

SyntaxError: missing before statement


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

Here you need to use assign operator = not comparison.


Thanks. It worked :grin:


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