What will the function return?

function freezeObj() {

  'use strict';

  const MATH_CONSTANTS = {

    PI: 3.14


  // Only change code below this line


  // Only change code above this line

  try {


  } catch(ex) {




1 Like

Just above the return MATH_CONSTANTS.PI; line you can type console.log(MATH_CONSTANTS.PI); and see for yourself :slight_smile:

1 Like

i’m sorry i should have asked what do you think it returns;
it should return 3.14, right?
this is what comes out: [TypeError: “PI” is read-only]

Welcome @drv to the FCC Programming Help. Yes, it’s expected to return 3.14, you can see the output of MATH_CONSTANTS.PI by calling the function freezeObj() below . When you try assigning a freeze obj , it throws an error- read only.

Here you can see details: Object.freeze()

The Object.freeze() method freezes an object. A frozen object can no longer be changed; freezing an object prevents new properties from being added to it, existing properties from being removed, prevents changing the enumerability, configurability, or writability of existing properties, and prevents the values of existing properties from being changed. In addition, freezing an object also prevents its prototype from being changed. freeze() returns the same object that was passed in.

You also can see the live output here live programming

1 Like