So I have a question on function 2 how are we supposed to these kinds of problems when 90 percent of syntax we HAVE to use on it, we did not learn or go over in the articles before the test your skills?
Please help me with this so Next time I know how to approach these kind of problems.
Hi @eakholod and welcome to the community
Yeah, you’re right. This one needs a bit of research since the canvas basics themselves are taught later in Client-side Web APIs - Drawing graphics. Maybe you want to open a issue on the MDN content GitHub ( Report a problem with this content on GitHub).
That being said, this is how I would approach this task:
Seeing this line of code const ctx = canvas.getContext('2d');
i would search for “getContext” on MDN to find out what it returns. The top search result leads me to HTMLCanvasElement.getContext(). On there I see that with 2d
as an argument we get a CanvasRenderingContext2D. On this page we’ll find all the methods/properties we need for this task.
The three methods/properties needed for the task (Click for spoiler)
- clearRect()
- fillStyle
- fillRect()
I hope this gets you further on this task. Please tell me if I can help you more.
Have a nice day,
Michael
Thank you for reaching out. Very much appreciated the help with the second problem. Ill try to right to MDN and see if they will reach back to me with a solution
You’re welcome!
By the way: Your email address is visible in your post. I think it somehow ended up in the optional “name” field of your profile. I recommend removing it.