window.onload = setup2d; function setup2d() { const canvas = document.getElementById("my-canvas"); const context = canvas.getContext("2d"); context.fillStyle = "rgb(200,0,0)"; context.fillRect(10,10,100,100); context.fillStyle = "rgb(0,200,0)"; context.fillRect(20,20,100,100); context.fillStyle = "rgb(0,0,200)"; context.fillRect(30,30,100,100);