Methods & this
We have Successfully Declared the Object identity
Accessing Functions in Objects
First , We have Declared an Object Identity and called its method fullDetails() which is Returning the Output.
You might be confused about this keyword, why it is used?
this keyword is used to refer to the object in which it it declared.
For Example: In Above Example we have declared an Object with name identity , then we have declared some properties and a method with name fullDetails
In the fullDetails Method, we have used this keyword to get the values of the key.
For Example : this.firstName is getting the value of Object identity with the Key firstName
this.lastName is getting the value of Object identity with the Key lastName
this.age is getting the value of Object identity with the Key age