165 views
How does this work inside an object method
Asked at
Task condition
You need to understand what output will appear in the console if you uncomment the line with the call to console.log.
const person = {
name: "Bob",
roles: ["friend", "brother", "student"],
getRoles: function () {
return this.roles.map(function (role) {
return this.name + " is " + role;
});
}
};
// console.log(person.getRoles()); // ?