NEVERMIND πŸ™ˆ (TypeError in ES6: Prevent Object Mutation)

Working in the ES6 exercise on the Object.freeze() function. All code is correct but the console is returning a TypeError as follows:

TypeError: Cannot assign to read only property 'PI' of object '#<Object>'

For reference, this is my code

function freezeObj() {
  "use strict";
  const MATH_CONSTANTS = {
    PI: 3.14
  };
  // change code below this line
  Object.freeze(MATH_CONSTANTS);

  // change code above this line
  try {
    MATH_CONSTANTS.PI = 99;
  } catch( ex ) {
    console.log(ex);
  }
  return MATH_CONSTANTS.PI;
}
const PI = freezeObj();

Browser Info:
Google Chrome Version 71.0.3578.98 (Official Build) (64-bit) on Mac OS 10.14.1

WAIT. Ignore this entirely. I’m silly…

1 Like

i think i’m having similar problem too, my code is correct but i don’t seem to know why its not running