The result of the following code is - undefined:
function f() {
    this.a = 1;
    return function() {
        console.log(this.a);
    };
}
(new f)();
The result of the following code is - undefined:
function f() {
    this.a = 1;
    return function() {
        console.log(this.a);
    };
}
(new f)();
 
    
    I think you're asking how to convert your anonymous function into an arrow function:
function f() {
    this.a = 1;
    return () => {
        console.log(this.a);
    };
}
(new f)();