The JavaScript Object seal() method prevents any new properties from being added and marks all existing properties as non-configurable.
Syntax:
Object.seal(object)
Object.seal(object)
Object.seal(object)
Parameters:
seal: It represents the object which has to be sealed.
Return:
Sealed Object.
Example:
<!DOCTYPE html>
<html>
<body>
<script>
const a = { prop: 'HELLO'};
const b = Object.seal(a);
b.prop = 'WORLD';
document.write(b.prop);
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<script>
const a = { prop: 'HELLO'};
const b = Object.seal(a);
b.prop = 'WORLD';
document.write(b.prop);
</script>
</body>
</html>
<!DOCTYPE html> <html> <body> <script> const a = { prop: 'HELLO'}; const b = Object.seal(a); b.prop = 'WORLD'; document.write(b.prop); </script> </body> </html>