Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created June 27, 2017 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/53b441818c6cea82d371a8746944ab1f to your computer and use it in GitHub Desktop.
Save codecademydev/53b441818c6cea82d371a8746944ab1f to your computer and use it in GitHub Desktop.
Codecademy export
function Person(first,last,age) {
this.firstname = first;
this.lastname = last;
this.age = age;
var bankBalance = 7500;
this.getBalance = function() {
var bankBalance = john.bankBalance;
return bankBalance;
};
}
var john = new Person('John','Smith',30);
console.log(john.bankBalance);
// create a new variable myBalance that calls getBalance()
var myBalance = john.getBalance();
console.log(myBalance);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment