Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Objects</h1>
<h2>The Object.seal() Method</h2>
<p id="demo"></p>
<script>
"use strict"
// Create Object
const person = {
  firstName: "John",
  lastName: "Doe",
  age: 50,
  eyeColor: "blue"
};
// Seal Object
Object.seal(person)
// Test Error
let text = "";
try {
  delete person.age;
}
catch (err) {
  text = err;
}
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>