Issues about instructions

*I have a little issue on instructions: Built-in Object Methods.

Declare a const variable named newRobot. newRobot will be a new object that has all the properties of robot and the properties in the following object: {laserBlaster: true, voiceRecognition: true}. Make sure that you are not changing the robot object!

The way I understood the instruction the properties and values of robot will be assigned first to the new variable. The next step would be to use the Object.assign method insert the following values {laserBlaster: true, voiceRecognition: true} and that’s what I did.

const robot = {
	model: 'SAL-1000',
  mobile: true,
  sentient: false,
  armor: 'Steel-plated',
  energyLevel: 75
};
const newRobot = Object.entries(robot) ;
Object.assign(newRobot,{laserBlaster: true, voiceRecognition: true}  );

I console it and their was no syntax error, I also check the MDN documents. But my understanding of the instruction is wrong!, what the instruction meant was that the {laserBlaster: true, voiceRecognition: true} is the target and robot object is the source.

const newRobot = Object.assign({laserBlaster: true, voiceRecognition: true}, robot);

I am not english speaker, can codecademy, make the sequence of the instruction more detail thanks :smiling_face:

If you console newRobot in your version, you won’t get a syntax error but the output will be:

console.log(newRobot);
# Output:
[ [ 'model', 'SAL-1000' ],
  [ 'mobile', true ],
  [ 'sentient', false ],
  [ 'armor', 'Steel-plated' ],
  [ 'energyLevel', 75 ],
  laserBlaster: true,
  voiceRecognition: true ]

The expected output which the solution code prints is:

console.log(newRobot);
# Output:
{ laserBlaster: true,
  voiceRecognition: true,
  model: 'SAL-1000',
  mobile: true,
  sentient: false,
  armor: 'Steel-plated',
  energyLevel: 75 }
1 Like

yeah exactly what I’m trying to say is that I am confuse with the instruction. I though the robot properties will be assign first because that was mention first. I miss understood the context of the instruction. :sweat_smile: