I am trying to run this piece of code in browser and compiler and getting two different outputs. What could be the cause for this `
'use strict';
var fName = 'Matilda';
const jonas = {
fName: 'jonas',
year: 1991,
greet: ()=> console.log(`Hey, ${this.fName}`),
};
jonas.greet();
`
Browser Output: Hey, Matilda
Compiler Output: Hey, undefined
I have tried running this code in several different compilers, and getting the same output. I was expecting a consistency in output between environments. I'll be glad if someone can give me a good theoretical explanation for the same.