I thought that a canvas was just a container for graphics made using JavaScript. So why is it that were able to draw those filled squares, when the canvas is empty? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I thought that a canvas was just a container for graphics made using JavaScript. So why is it that were able to draw those filled squares, when the canvas is empty?

I'm sure it sounds stupid but I'm confused. I did the try it your self option, and checked to see if there was any JavaScript written. But they weren't. Please clarify

29th Sep 2016, 3:43 AM
Tenzin Kalden
Tenzin Kalden - avatar
2 Answers
+ 1
You may be confusing canvas graphics with SVG. SVG does not use the canvas. A canvas container is required when drawing with JavaScript.
29th Sep 2016, 4:44 AM
Derek F
+ 1
Those field squares aren't the graphics it's just the canvas environment where graphics are drawn used javascript That is why we have <canvas id="canvas" width="" height=""> But the actual graphics are drawn using javascript
30th Oct 2016, 12:27 AM
victor eberechi
victor eberechi - avatar