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