/* 2 */ - In this line, this. refers to the current object instance which in this case is nickname. It is basically saying that the nickname property of this is equal to whatever is passed in the constructor function itself. This object is created using dot notation so that object can be stored in a singular function.
/* 3 */ - This shows dot notation of age by using this.age, which is equal to the age that is passed in this particular function or object instance. Again, it’s saying the …show more content…
This.x is the dot notation of the variable x.
/* 5 */ - This.y equals to the y that is being used in a specific instance of the object, in this case, y. This.y is the dot notatiion of the variable y. This object is created using dot notation so that object can be stored in a singular function.
/* 6 */ - This ends the Winston function.
/* 7 */ - Then, the variable winstonTeen is set to equal a new Winston that has the parameters: nickname: “Winsteen”, age: 15, x: 20, y: 50.
/* 8 */ - The variable winstonAdult is set to equal a new Winston that has the parameters: nickname: “Mr. Winst-a-lot”, age: 30, x: 229, y: 50.
/* 9 */ - A new variable is created which is called drawWinston is set to equal a draw function that has the parameter of …show more content…
This variable makes it so that winston’s nickname and winston’s age is separated by a comma in the middle by adding winston.nickname, “,”, and winston’s age.
/* 14 */ - Then the variable txt is displayed on the canvas so that the text displays: winston’s nickname, winston’s age. It also uses winstons’s x and y coordinates but 20 is added on winston.x and subtracted 10 from winston.y.
/* 15 */ - This ends the drawWinston function.
/* 16 */ - The variable winstons is set equal to the array of the objects: winstonTeen, and winstonAdult.
/* 17 */ - Then, it draws the first winston in the array, which is winstonTeen. This displays the image of winston, the nickname: “Winsteen”, age: 15, x: 20, and y: 50. The text, which displays wistonTeen’s nickname and age which is separated by a comma. It is about 20 spaces to the right of the Winston function and 10 spaces up from the original Winston function.
/* 18 */ - It draws the second winston in the array, which is winstonAdult. This displays the image of winston, the nickname: “Mr. Winst-a-lot”, age: 30, x: 229, and y: 50. The text, which displays wistonAdult’s nickname and age which is separated by a comma. It is about 20 spaces to the right of the Winston function and 10 spaces up from the original Winston