Where should I add the given code, it is giving me errors

In the above mentioned link,

const myDataName = 'height';
const myDataValue = '1.75m';
person[myDataName] = myDataValue;

Where should I add this code, it is giving me an error since inside the object we cannot assign the value.
In the console also,I m getting error.

Hi @vaishnavi_A.N

This goes after the person object. You have something like this:

const person = {
  ...
};

const myDataName = 'height';
const myDataValue = '1.75m';
person[myDataName] = myDataValue;

We define some properties when creating the person object in the first part. Then we add another property height with the second part.

Please tell me if you need more help. :slightly_smiling_face:

Happy coding,
Michael

2 Likes

Yeah its clear now, I was confused with the line:
To test this, try adding the following lines into your code, just below the closing curly brace of the person object:
Thank u @mikoMK :heart_eyes: :heart_eyes:

1 Like