scrimba
Learn Modern JavaScript
Prevent Object Mutation
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Prevent Object Mutation
AboutCommentsNotes
Prevent Object Mutation
Expand for more info
index.js
run
preview
console
function freezeObj() {
"use strict";
const MATH_CONSTANTS = {
PI: 3.14
};

try {
MATH_CONSTANTS.PI = 99;
} catch( ex ) {
console.log(ex);
}
return MATH_CONSTANTS.PI;
}

const PI = freezeObj();

console.log(PI);
Console
99
,
index.html
-2:21