To fix this, use the concept of this keyword. User another variable to hold the value of object, to use that inside the inner function.
Following is the code −
To run the above program, you need to use the following command −
Here, my file name is demo216.js.
The output is as follows −