class Cls {
constructor({
outside
}) {
this.outside = outside;
}
inside = () => {
console.log('inside', this);
};
}
const outside = () => {
console.log('outside', this);
};
const instance = new Cls({
outside
});
instance.inside(); // "inside" instance
instance.outside(); // "outside" window