Created
June 19, 2018 14:52
-
-
Save anacampesan/37ab6f518542d3bb8c2e0cac2fcc59d7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| let animal = { | |
| init: function(name, age) { | |
| this.name = name; | |
| this.age = age; | |
| return this; | |
| }, | |
| getName: function() { | |
| return this.name; | |
| }, | |
| getAge: function() { | |
| return this.age; | |
| } | |
| } | |
| let human = Object.create(animal).init('Ana', 24); | |
| console.log(human.getAge()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment