I was doing the JS course, and I was going through the “Built-in Object Methods (ADVANCED OBJECTS)” exercise when I was creating step 3. The Object.assign().
I created the following code:
This was, according to the exercise, wrong. I was wondering why, so I took a look at the error message which said:
Did you provide the correct second argument? The
robotobject should not be changed
Mhm… alright. I took a look at the solution, there it said the following:
So, first the new code, then the object you want to assign the code to. This seemed inlogical to me. So next I took a look at the MDN’s Syntax section:
There it explains the first argument is the target, the second is the source.
Isnt it so that the robot object is the target which you want to add the code to, and the code is the source? Thus making robot the first argument, and the code the second? Or am I getting something wrong here?