Standard built-ins

Object.seal()

Try the free JavaScript compiler

Prevents extensions and makes all own properties nonconfigurable. Existing writable data fields may still be assigned.

Formal Syntax & Structure

javascript syntaxjavascript
Object.seal(obj)

Parameters & Attributes

NameTypeDescription
objObjectTarget object.

Return Value

Object

Same target (or unchanged primitive).

Working Example

Example Snippetjavascript
const o=Object.seal({n:1});o.n=5;console.log(o.n,Object.isSealed(o));
JavaScript Reference