Skip to content

Instantly share code, notes, and snippets.

@mariyadiminsky
Created May 16, 2016 10:23
Show Gist options
  • Save mariyadiminsky/966674f54af74e3494f3ecb687212c4a to your computer and use it in GitHub Desktop.
Save mariyadiminsky/966674f54af74e3494f3ecb687212c4a to your computer and use it in GitHub Desktop.
// Test it here: https://jsfiddle.net/maasha/u8ybgwd5/
var bunny = {
name: 'Usagi',
tasks: ['transform', 'eat cake', 'blow kisses'],
showTasks: function() {
this.tasks.forEach(function(task) {
alert(this.name + " wants to " + task);
}.bind(this));
}
};
bunny.showTasks();
// Usagi wants to transform
// Usagi wants to eat cake
// Usagi wants to blow kisses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment