-
-
Save fancn21th/2d89d5c9e7d7ccf8bb971b36bed5c15c to your computer and use it in GitHub Desktop.
Beneath Classes: Prototypes
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
| class Spiderman { | |
| lookOut() { | |
| alert('My Spider-Sense is tingling.'); | |
| } | |
| } | |
| let miles = new Spiderman(); | |
| miles.lookOut(); |
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
| // class Spiderman { | |
| let SpidermanPrototype = { | |
| lookOut() { | |
| alert('My Spider-Sense is tingling.'); | |
| } | |
| }; | |
| // let miles = new Spiderman(); | |
| let miles = { __proto__: SpidermanPrototype }; | |
| miles.lookOut(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment