23/30 whats wrong?


#1

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

// create your Person
var lock = new Person('Lock','Mechx',24);
var myFirst = lock.firstName;
var myLast = lock.lastName;
var myAge = lock.age;
// try to print his bankBalance
var bankBalance = 10000;

Oops, try again. Your code threw the following error when testing john: ReferenceError: john is not defined


#2

Read carefuly the instructions:
"Create an object john using the Person constructor. "

Your object is named lock, not john.

And here:

You are not printing the balance. You are just setting new variable. The balance is here:

Use the object which is already created like this:

console.log(john.bankBalance);

Also you don't need those variables: