SOURCE

console 命令行工具 X clear

                    
>
console
function drawRect() {
  var c1=document.getElementById("aaa");
  var ctx=c1.getContext("2d");
  ctx.fillStyle="red";
  ctx.fillRect(0,0,300,300);
  ctx.fillStyle="green";
  ctx.font="30px Arial";
  ctx.textBaseline="top";
  ctx.fillText('rafer', 0, 0);
  var img=new Image();
  img.onload=function(){
    ctx.drawImage(img, 50, 50, 100, 50);
    ctx.strokeStyle="black";
  	ctx.strokeRect(50, 50, 100, 100);
  }
  img.src="https://www.baidu.com/img/bd_logo1.png?where=super";
}
window.onload=drawRect;
<canvas id="aaa" width="300" height="300">Not Support</canvas>