-
-
Save codecademydev/49213cd7978c4917b369ea6989b940c3 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// here we define our method using "this", before we even introduce bob | |
var setAge = function (newAge) { | |
this.age = newAge; | |
}; | |
// now we make bob | |
var bob = new Object(); | |
bob.age = 30; | |
// and down here we just use the method we already made | |
bob.setAge = setAge; | |
// change bob's age to 50 here | |
bob.setAge(50); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment