Tell us what’s happening:
As I’m doing all try and even using chrome as browser this showing an error always.
I really don’t know what’s the problem in the code.
Your code so far
function freezeObj() {
"use strict";
const MATH_CONSTANTS = {
PI : 3.14
};
// Only change code below this line
Object.freeze(MATH_CONSTANTS);
// Only change code above this line
try {
MATH_CONSTANTS.PI = 99;
} catch(ex) {
console.log(ex);
}
return MATH_CONSTANTS.PI;
}
const PI = freezeObj();
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 7.1.1; CPH1729) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36.
Your code should’ve worked fine, but it is because you messed with the setup code that made the test failed.
It’s probably best to press the Reset All Code and just wre-write the code you only needed which is Object.freeze(MATH_CONSTANTS);.
When the challenge says Only change code above/below this line it meant it, if you change it, it can cause it to fail. Next time, please write your code where you are told to…