Tell us what’s happening:
has anyone noticed you still get an error if you even solve the solution to the challenge correctly? is it a freecodecamp bug or there is something wrong with my solution. i cant progress to the next lesson because of this bug
Your code so far
function freezeObj() {
"use strict";
const MATH_CONSTANTS = {
PI: 3.14
};
Object.freeze(MATH_CONSTANTS);
try {
MATH_CONSTANTS.PI = 99;
} catch (ex) {
console.log(ex);
}
return MATH_CONSTANTS.PI;
}
const PI = freezeObj();
// [TypeError: Cannot assign to read only property 'PI' of object '#<Object>']
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.
Challenge: Prevent Object Mutation
Link to the challenge: