What is the best way of drawing with canvas js?

I recently created a code with javascript and used the trial and error method which worked, but i was wondering if there is a more efficient way of drawing on canvas? here is my canvas code: https://code.sololearn.com/WYX9IOAZ2iQ3/?ref=app

1/3/2020 10:08:58 PM

toto(enjoying html)

2 Answers

New Answer


I'd say that is one of the most efficient ways of canvas drawing, especially with the functional abstractions. If you ever need to later dynamically change the positions of the shapes, I would recommend integrating classes. CodingTrain on YouTube has some very good videos on this concept.


Thank you SuperC for the good explanation, I have been currently watching the CodingTrain P5, and I will definitely check out his videos on integrating classes...thank you for the recommendation and explanation.