<body> | |
<canvas id="canvas" width="100" height="100"> | |
<script> | |
const canvas = document.getElementById("canvas"); | |
const ctx = canvas.getContext("2d"); | |
const { width, height } = canvas; | |
ctx.fillStyle = "green"; | |
ctx.fillRect(0, 0, width, height); | |
</script> | |
</body> |