Skip to content

Instantly share code, notes, and snippets.

@michacom
Created September 13, 2016 13:10
Show Gist options
  • Save michacom/25c238a05ae5e08df11cbeeb7ac59a66 to your computer and use it in GitHub Desktop.
Save michacom/25c238a05ae5e08df11cbeeb7ac59a66 to your computer and use it in GitHub Desktop.
person = {
firstName: 'Moshe',
lastName: 'Cohen',
moods: ['happy', 'angry', 'sad'],
giveMeName: function () {
this.moods.forEach((mood) => {
console.log(this.firstName + " " + this.lastName + ' Can be ' + mood);
});
}
}
person = {
firstName: 'Moshe',
lastName: 'Cohen',
moods: ['happy', 'angry', 'sad'],
giveMeName: function () {
this.moods.forEach(
function(mood) {
console.log(this.firstName + " " + this.lastName + ' Can be ' + mood);
},
this
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment