I’m struggling with this challenge. I can’t seem to get the color of the rectangle to change from the default ‘black’ to ‘blue’. Also, am I using the .fillRect method correctly?
Thanks!
Leo
Hello @Leo_S
you need to set the color first
ctx.fillStyle = color;
ctx.fillRect(x, y, width, height);
cause your code make it draw the rectangle then set the color to blue
one more thing you do not need the last ctx.fill(); line use this one when you fill a path https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fill as fillrect draw the rectangle and fill it also
hope that help and have a nice day
hope that help and have a nice day