class foo {
constructor(exec) {
const bar = function () {
console.log(this);
};
exec(bar);
}
}
new foo((bar) => {
bar();
});
Why would 'this' be undefined rather than global
class foo {
constructor(exec) {
const bar = function () {
console.log(this);
};
exec(bar);
}
}
new foo((bar) => {
bar();
});
Why would 'this' be undefined rather than global