Scope and Nested Functions
Both have a nested function called nestedFunction inside a method called addPerson.
In room1, that nested function is a lambda and the use of the this keyword blows away the global variable called 'person'.
In room2, that nested function is a named function. The this keyword does not blow away the 'person' in the global scope.
I think room1.nestedFunction is a function but not a method. But I'm not sure why. I guess because its context makes it a function expression as distinct from a function declaration.
I not sure how that analysis would apply to room2.nestedFunction. Perhaps it is a method, but I'm not sure what method it is a function of. The addPerson object?
So, I can basically see what is happening here. I just don't have an understanding of why. What is the difference between a lambda function and a named function when nested inside a property (addPerson). What is going on here?
Thanks in advance.