Last active
November 26, 2017 16:31
-
-
Save nikkaroraa/6477dc1e24ebf26384f06297354aa5c5 to your computer and use it in GitHub Desktop.
Rebind "this" (Fat-Arrow)
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
| //Fat-Arrow syntax | |
| var blog = { | |
| name: 'The School Of JS', | |
| topics: ['DOM', 'JS'], | |
| about: function () { | |
| return this.topics.map(topic => topic + ' is a topic of ' + this.name + ' blog!'); | |
| } | |
| }; | |
| blog.about(); | |
| //["DOM is a topic of The School Of JS blog!", "JS is a topic of The School Of JS blog!"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment