On this page
  1. Object.freeze
  2. Signature & Overview
  3. Notes & Pitfalls
  4. Example

Object.freeze

Prev: create | Up: Object | Next: groupBy
Rel: Object, Object & Reflect Guide
Ref: MDN Web Docs — Object.freeze
Tags: #public #web #javascript #builtins #object #tier/standard


Signature & Overview

Object.freeze(obj)

Prevents adding, removing, or modifying own properties of obj (shallow immutability).

Notes & Pitfalls

Example

const cfg = Object.freeze({ env: "prod" });
console.assert(Object.isFrozen(cfg) === true);

Linked from

Related notes