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 id="demo"></p> <script> // Create an object: const person = { firstName: "Mahmoud", lastName: "alaa", language: "", set lang(lang) { this.language = lang.toUpperCase(); } }; // Set a property using set: person.lang = "en"; // Display data from the object: document.getElementById("demo").innerHTML = person.language; </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8aDI+SmF2YVNjcmlwdCBHZXR0ZXJzIGFuZCBTZXR0ZXJzPC9oMj4NCg0KPHA+R2V0dGVycyBhbmQgc2V0dGVycyBhbGxvdyB5b3UgdG8gZ2V0IGFuZCBzZXQgcHJvcGVydGllcyB2aWEgbWV0aG9kcy48L3A+DQoNCjxwIGlkPSJkZW1vIj48L3A+DQoNCjxzY3JpcHQ+DQovLyBDcmVhdGUgYW4gb2JqZWN0Og0KY29uc3QgcGVyc29uID0gew0KICBmaXJzdE5hbWU6ICJNYWhtb3VkIiwNCiAgbGFzdE5hbWU6ICJhbGFhIiwNCiAgbGFuZ3VhZ2U6ICIiLA0KICBzZXQgbGFuZyhsYW5nKSB7DQogICAgdGhpcy5sYW5ndWFnZSA9IGxhbmcudG9VcHBlckNhc2UoKTsNCiAgfQ0KfTsNCg0KLy8gU2V0IGEgcHJvcGVydHkgdXNpbmcgc2V0Og0KcGVyc29uLmxhbmcgPSAiZW4iOw0KDQovLyBEaXNwbGF5IGRhdGEgZnJvbSB0aGUgb2JqZWN0Og0KZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoImRlbW8iKS5pbm5lckhUTUwgPSBwZXJzb24ubGFuZ3VhZ2U7DQo8L3NjcmlwdD4NCg0KPC9ib2R5Pg0KPC9odG1sPg==