Skip to content

Instantly share code, notes, and snippets.

@amowu
Forked from ericelliott/frozen-objects.js
Created January 15, 2017 08:38
Show Gist options
  • Select an option

  • Save amowu/88b43f727e340d3f7792e869c4f0b172 to your computer and use it in GitHub Desktop.

Select an option

Save amowu/88b43f727e340d3f7792e869c4f0b172 to your computer and use it in GitHub Desktop.
Frozen object
const a = Object.freeze({
foo: 'Hello',
bar: 'world',
baz: '!'
});
a.foo = 'Goodbye';
// Error: Cannot assign to read only property 'foo' of object Object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment