<!DOCTYPE html>
<html>
<body>
<h1>JavaSript Objects</h1>
<h2>The defineProperty() Method</h2>
<p>The defineProperty() method can define setters and getters:</p>
<p id="demo"></p>
<script>
const person = {
firstName: "John",
lastName : "Doe",
language : "NO"
};
Object.defineProperty(person, "language", {
get : function() { return language },
set : function(value) { language = value.toUpperCase()}
});
person.language = "en";
document.getElementById("demo").innerHTML = person.language;
</script>
</body>
</html>