Skip to content

Instantly share code, notes, and snippets.

@nikkaroraa
Last active November 26, 2017 16:31
Show Gist options
  • Save nikkaroraa/6477dc1e24ebf26384f06297354aa5c5 to your computer and use it in GitHub Desktop.
Save nikkaroraa/6477dc1e24ebf26384f06297354aa5c5 to your computer and use it in GitHub Desktop.
Rebind "this" (Fat-Arrow)
//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