Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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