i have the following code . i expected console.log(this.info) to print john in the browser console . but it prints undefined . can someone tell me why ?
const firstObj = {
info: "john",
display: function (logger) {
logger();
}
}
const secondObj = {
info: "mike",
logger: function () {
console.log(this.info); // logs undefind . but i expected to log john
}
};
firstObj.display(secondObj.logger);