Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
486 B
1
Indexable
Never
<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Object Properties</h2>
<p>Access a property with .property:</p>

<p id="demo"></p>
<p id="apple"></p>

<script>
const person = {
  firstname: "John",
  lastname: "Doe",
  age: 50,
  eyecolor: "blue"
};

document.getElementById("apple").innerHTML =person.lastname + " is having" + person.eyecolor + " coloured eye.";
document.getElementById("demo").innerHTML =person.firstname + " is" + person.age + " years old.";

</script>
</body>
</html>