<canvas id="mycanvas3" width="400" height="400"></canvas>
let canvas = document.getElementById('mycanvas3')
if (canvas.getContext) {
let ctx = canvas.getContext('2d')
ctx.beginPath()
ctx.moveTo(20,20)
ctx.lineTo(40,20)
ctx.lineTo(40, 40)
ctx.lineTo(20, 40)
ctx.closePath()
ctx.fill()
} else {
console.log('浏览器不支持canvas')
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.