Duplicate Question
The question on this page has been marked as a duplicate question.
Original Question
Random color square JavaScript Write a program that draws a random color square centered on the graphics canvas. The sides of t...Question
Random color square JavaScript
Write a program that draws a random color square centered on the graphics canvas. The sides of the square should be SIDE_LENGTH.
(Hint: Use the Randomizer to get a random color for the square.)
What am I doing wrong?
var SIDE_LENGTH = 100;
function start(){
var square = new Rectangle (100,100);
var x = getWidth()/2;
var y = getHeight()/2;
square.setPosition(x,y);
var color = Randomizer.nextColor();
square.setColor(color);
add(square);
}
Write a program that draws a random color square centered on the graphics canvas. The sides of the square should be SIDE_LENGTH.
(Hint: Use the Randomizer to get a random color for the square.)
What am I doing wrong?
var SIDE_LENGTH = 100;
function start(){
var square = new Rectangle (100,100);
var x = getWidth()/2;
var y = getHeight()/2;
square.setPosition(x,y);
var color = Randomizer.nextColor();
square.setColor(color);
add(square);
}
Answers
There are no human answers yet.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.