Rangle.io : Angular Training
Search…
Introduction
License
Why Angular?
The Architect's Guide to Angular
EcmaScript 6 and TypeScript Features
The JavaScript Toolchain
Bootstrapping an Angular Application
Components in Angular
Directives
Advanced Components
Observables
Angular Dependency Injection
Http
Change Detection
Zone.js
Advanced Angular
What is Immutability
The Case for Immutability
JavaScript Solutions
Object.assign
Object.freeze
Pipes
Forms
Modules
Routing
State Management
TDD Testing
Migrating AngularJS Projects to Angular
Project Setup
Angular CLI
Accessibility in Angular
Internationalization in Angular
Glossary
Further Reading And Reference
Powered By
GitBook
Object.freeze
Object.freeze
allows us to disable object mutation.
1
let
movie1
=
{
2
name
:
'Star Wars'
,
3
episode
:
7
4
};
5
6
let
movie2
=
Object
.
freeze
(
Object
.
assign
({},
movie1
));
7
8
movie2
.
episode
=
8
;
// fails silently in non-strict mode,
9
// throws error in strict mode
10
11
console
.
log
(
movie1
.
episode
);
// writes 7
12
console
.
log
(
movie2
.
episode
);
// writes 7
Copied!
Previous
Object.assign
Next
Pipes
Last modified
10mo ago
Copy link