crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>JavaScript Object Methods</h2> <p>Object data can be accessed using a getter.</p> <p id="demo"></p> <script> // Create an object: const person = { firstName: "ahmed", lastName: "salah", get fullName() { return this.firstName + " " + this.lastName; } }; // Display data from the object using a getter: document.getElementById("demo").innerHTML = person.fullName( ); </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8aDI+SmF2YVNjcmlwdCBPYmplY3QgTWV0aG9kczwvaDI+DQoNCjxwPk9iamVjdCBkYXRhIGNhbiBiZSBhY2Nlc3NlZCB1c2luZyBhIGdldHRlci48L3A+DQoNCjxwIGlkPSJkZW1vIj48L3A+DQoNCjxzY3JpcHQ+DQovLyBDcmVhdGUgYW4gb2JqZWN0Og0KY29uc3QgcGVyc29uID0gew0KICBmaXJzdE5hbWU6ICJhaG1lZCIsDQogIGxhc3ROYW1lOiAic2FsYWgiLA0KICBnZXQgZnVsbE5hbWUoKSB7DQogICAgcmV0dXJuIHRoaXMuZmlyc3ROYW1lICsgIiAiICsgdGhpcy5sYXN0TmFtZTsNCiAgfQ0KfTsNCg0KLy8gRGlzcGxheSBkYXRhIGZyb20gdGhlIG9iamVjdCB1c2luZyBhIGdldHRlcjoNCmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJkZW1vIikuaW5uZXJIVE1MID0gcGVyc29uLmZ1bGxOYW1lKCApOw0KPC9zY3JpcHQ+DQoNCjwvYm9keT4NCjwvaHRtbD4=