crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>JavaScript Getters and Setters</h2> <p>Getters and setters allow you to get and set properties via methods.</p> <p>This example uses a lang property to set the value of the language property.</p> <p id="demo"></p> <script> const person = { firstName: "ahmed", lastName: "ali", language: "", set lang(lang) { this.language = lang; } }; // Set an object property using a setter: person.lang = "ar"; // Display data from the object: document.getElementById("demo").innerHTML = person.language; </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8aDI+SmF2YVNjcmlwdCBHZXR0ZXJzIGFuZCBTZXR0ZXJzPC9oMj4NCg0KPHA+R2V0dGVycyBhbmQgc2V0dGVycyBhbGxvdyB5b3UgdG8gZ2V0IGFuZCBzZXQgcHJvcGVydGllcyB2aWEgbWV0aG9kcy48L3A+DQoNCjxwPlRoaXMgZXhhbXBsZSB1c2VzIGEgbGFuZyBwcm9wZXJ0eSB0byBzZXQgdGhlIHZhbHVlIG9mIHRoZSBsYW5ndWFnZSBwcm9wZXJ0eS48L3A+DQoNCjxwIGlkPSJkZW1vIj48L3A+DQoNCjxzY3JpcHQ+DQpjb25zdCBwZXJzb24gPSB7DQogIGZpcnN0TmFtZTogImFobWVkIiwNCiAgbGFzdE5hbWU6ICJhbGkiLA0KICBsYW5ndWFnZTogIiIsDQogIHNldCBsYW5nKGxhbmcpIHsNCiAgICB0aGlzLmxhbmd1YWdlID0gbGFuZzsNCiAgfQ0KfTsNCg0KLy8gU2V0IGFuIG9iamVjdCBwcm9wZXJ0eSB1c2luZyBhIHNldHRlcjoNCnBlcnNvbi5sYW5nID0gImFyIjsNCg0KLy8gRGlzcGxheSBkYXRhIGZyb20gdGhlIG9iamVjdDoNCmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJkZW1vIikuaW5uZXJIVE1MID0gcGVyc29uLmxhbmd1YWdlOw0KPC9zY3JpcHQ+DQoNCjwvYm9keT4NCjwvaHRtbD4=