I am a begeiner and facing a problem about javascript object this method. I attached the code for better understanding. In this code, isn't it supposed to return 'firstName' property value of 'user' object? But why it show Error?
let user = {
    firstName: "Ilya",
    sayHi: function() {
        function x() {
            return console.log(this.firstName);
        }
        return x()
    }
}
user.sayHi();I know if i use arrow function instead of function declaration, then it work properly. Also if i use a single function as property key then it also working but i don't understand why nested function deceleration not work. Can you please help me to understand the underling cause ? Sorry for my bad English as it is my second language. Thanks in advance.
 
     
    