Task 2: Correct. You clear exactly the area where the blue rectangle is. This works for this specific exercise. Normally when you’re having a draw() function, you would start by clearing the whole canvas: ctx.clearRect(0, 0, canvas.width, canvas.height);
Task 3: Mostly correct. The exercise ask for the random() function to have two generic bounds. It should look like this:
function random(min, max) {
...
return num;
}
You need to implement the function so that you can use names[random(0, array.length)] to get a random name from the array.
Task 4: Correct.
Please tell me if you need more help with the task 3.
For task 3:
I would recommend to define the max parameter as just a number (like min) and use random(0, array.length) to call it. This way we just have to work with numbers inside the random() function.
The other thing is: Your formula isn’t quite right. You subtract min and immediately add it back. So the min value doesn’t have an effect. random(3,8) would still give a number between 0 and 7. + min needs to be outside Math.floor() and then it should work.