crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>JavaScript Getters and Setters</h2> <p>Getters and setters allow you to get and set object properties via methods.</p> <p>This example uses a lang property to get the value of the language property:</p> <p id="demo"></p> <script> // Create an object: const person = { firstName: "ahmed", lastName: "saleh", language: "en", get lang() { return this.language; } }; // Display data from the object using a getter: document.getElementById("demo").innerHTML = person.lang; </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8aDI+SmF2YVNjcmlwdCBHZXR0ZXJzIGFuZCBTZXR0ZXJzPC9oMj4NCg0KPHA+R2V0dGVycyBhbmQgc2V0dGVycyBhbGxvdyB5b3UgdG8gZ2V0IGFuZCBzZXQgb2JqZWN0IHByb3BlcnRpZXMgdmlhIG1ldGhvZHMuPC9wPg0KDQo8cD5UaGlzIGV4YW1wbGUgdXNlcyBhIGxhbmcgcHJvcGVydHkgdG8gZ2V0IHRoZSB2YWx1ZSBvZiB0aGUgbGFuZ3VhZ2UgcHJvcGVydHk6PC9wPg0KDQo8cCBpZD0iZGVtbyI+PC9wPg0KDQo8c2NyaXB0Pg0KLy8gQ3JlYXRlIGFuIG9iamVjdDoNCmNvbnN0IHBlcnNvbiA9IHsNCiAgZmlyc3ROYW1lOiAiYWhtZWQiLA0KICBsYXN0TmFtZTogInNhbGVoIiwNCiAgbGFuZ3VhZ2U6ICJlbiIsDQogIGdldCBsYW5nKCkgew0KICAgIHJldHVybiB0aGlzLmxhbmd1YWdlOw0KICB9DQp9Ow0KDQovLyBEaXNwbGF5IGRhdGEgZnJvbSB0aGUgb2JqZWN0IHVzaW5nIGEgZ2V0dGVyOg0KZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoImRlbW8iKS5pbm5lckhUTUwgPSBwZXJzb24ubGFuZzsNCjwvc2NyaXB0Pg0KDQo8L2JvZHk+DQo8L2h0bWw+