Favorites

JavaScript Object.seal() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Object.seal()
JavaScript Object Static methodThis method is supported by all modern browsers.
Updated 28th November 2026

The Object.seal() static method stops properties being added to or removed from an object, while still letting existing values change.

Description

The Object.seal() static method seals an object: new properties can't be added and existing ones can't be deleted or reconfigured, but the values of writable properties can still be changed. It sits between a normal object and a frozen one. Like freezing, it's shallow.

Sealing is useful for objects whose shape should stay fixed, such as a configuration object with known settings, while still letting values change. Typos in property names then throw in strict mode instead of quietly creating a new property.

Object.isSealed() checks whether an object is sealed. Like freezing, sealing only affects the object itself, so objects stored inside it can still gain or lose properties unless you seal them too.

Syntax

Object.seal(obj)

Parameters

  • objThe object to seal.

Return Value

The same object, now sealed.

Example

'use strict';
const point = Object.seal({ x: 1, y: 2 });
point.x = 10;
console.log(point.x);
try { point.z = 3; } catch (e) { console.log(e.name); }
console.log(Object.isSealed(point));

Browser Support

The following information will show you the current browser support for the Object.seal() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee