This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.



Smartphone icons created by Freepik - Flaticon

JS Object.defineProperty()

This example adds a new property to an object.

// Create an object:
const person = {
  firstName: "John",
  lastName: "Doe",
  language: "EN"
};

// Add a property
Object.defineProperty(person, "year", {value:"2008"})
document.getElementById("demo").innerHTML = person.year;