Skip to content

Instantly share code, notes, and snippets.

@mariyadiminsky
Last active May 16, 2016 10:11
Show Gist options
  • Save mariyadiminsky/64454e590d14610318e1d988813f74a2 to your computer and use it in GitHub Desktop.
Save mariyadiminsky/64454e590d14610318e1d988813f74a2 to your computer and use it in GitHub Desktop.
// Test it here: https://jsfiddle.net/maasha/z65c1znn/
var bunny = {
name: 'Usagi',
tasks: ['transform', 'eat cake', 'blow kisses'],
showTasks: function() {
this.tasks.forEach(function(task) {
alert(this.name + " wants to " + task);
});
}
};
bunny.showTasks();
// [object Window] wants to transform
// [object Window] wants to eat cake
// [object Window] wants to blow kisses
// please note, in jsfiddle the [object Window] is named 'result' within inner functions of methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment