Ask coding questions

← Back to all posts
line canvas
THREE1 (0)

Hi, I am trying to draw a line in canvas html
(https://storage.googleapis.com/replit/images/1618500893276_fd020107ba9b481531f57329e343419e.png)
but something is wrong so what is it

Comments
hotnewtop
notGilbert (121)

The elements inside a <canvas> only gets rendered when canvas is not supported, just move the <script> tag outside of the canvas tag

<body>
  <canvas id="car"></canvas>
  <script>
    // existing code
  </script>
</body>