Question
In a graphics canvas, what are the coordinates of the center of the canvas? getWidth(), getHeight() JavaScript getWidth() / 2, getHeight() / 2 JavaScript getHeight() - getWidth(), getWidth() - getHeight() JavaScript getHeight() / 2, getWidth() / 2
Answers
GPT-4o mini
To find the coordinates of the center of a graphics canvas in JavaScript, you would use the `getWidth()` method and the `getHeight()` method to obtain the width and height of the canvas. The center coordinates can be calculated as follows:
```javascript
let centerX = getWidth() / 2;
let centerY = getHeight() / 2;
```
So the correct answer among the options you provided is:
**`JavaScript getWidth() / 2, getHeight() / 2`**
```javascript
let centerX = getWidth() / 2;
let centerY = getHeight() / 2;
```
So the correct answer among the options you provided is:
**`JavaScript getWidth() / 2, getHeight() / 2`**