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);
}
1 answer
start();