Question
Consider the following code of a circle:
1 let circ = new Circle(50);
2 circ.setPosition(200, 200);
3 circ.setColor("blue");
4 add(circ);
JavaScript
If we wanted to move the circle 10 pixels to the left, what change would we need to make?
Add 10 to line 1:
1 let circ = new Circle(60);
2 circ.setPosition(200, 200);
3 circ.setColor("blue");
4 add(circ);
JavaScript
Subtract 10 from the first number on line 2:
1 let circ = new Circle(50);
2 circ.setPosition(190, 200);
3 circ.setColor("blue");
4 add(circ);
JavaScript
Subtract 10 from the second number on line 2:
1 let circ = new Circle(50);
2 circ.setPosition(200, 190);
3 circ.setColor("blue");
4 add(circ);
JavaScript
Add 10 to the first number on line 2:
1 let circ = new Circle(50);
2 circ.setPosition(210, 200);
3 circ.setColor("blue");
4 add(circ);
JavaScript
Add 10 to the second number on line 2:
1 let circ = new Circle(50);
2 circ.setPosition(200, 210);
3 circ.setColor("blue");
4 add(circ);
JavaScript
1 let circ = new Circle(50);
2 circ.setPosition(200, 200);
3 circ.setColor("blue");
4 add(circ);
JavaScript
If we wanted to move the circle 10 pixels to the left, what change would we need to make?
Add 10 to line 1:
1 let circ = new Circle(60);
2 circ.setPosition(200, 200);
3 circ.setColor("blue");
4 add(circ);
JavaScript
Subtract 10 from the first number on line 2:
1 let circ = new Circle(50);
2 circ.setPosition(190, 200);
3 circ.setColor("blue");
4 add(circ);
JavaScript
Subtract 10 from the second number on line 2:
1 let circ = new Circle(50);
2 circ.setPosition(200, 190);
3 circ.setColor("blue");
4 add(circ);
JavaScript
Add 10 to the first number on line 2:
1 let circ = new Circle(50);
2 circ.setPosition(210, 200);
3 circ.setColor("blue");
4 add(circ);
JavaScript
Add 10 to the second number on line 2:
1 let circ = new Circle(50);
2 circ.setPosition(200, 210);
3 circ.setColor("blue");
4 add(circ);
JavaScript
Answers
Answered by
GPT-4o mini
To move the circle 10 pixels to the left, you need to decrease the x-coordinate value by 10. In line 2 of your code, the x-coordinate is currently 200. To move it 10 pixels to the left, you should change it to 190.
Thus, the correct change is:
```javascript
1 let circ = new Circle(50);
2 circ.setPosition(190, 200); // Subtract 10 from the first number
3 circ.setColor("blue");
4 add(circ);
```
So the correct option is:
**Subtract 10 from the first number on line 2.**
Thus, the correct change is:
```javascript
1 let circ = new Circle(50);
2 circ.setPosition(190, 200); // Subtract 10 from the first number
3 circ.setColor("blue");
4 add(circ);
```
So the correct option is:
**Subtract 10 from the first number on line 2.**