A canvas clearRect example

function canvasReady() {
  document.body.style.backgroundColor = "#eee";
  document.getElementById('canvas').style.backgroundColor = "#008888";
  draw(document.getElementById('canvas').getContext('2d'));
}
function draw(ctx){
  ctx.beginPath();
  ctx.fillStyle = "pink";
  ctx.arc(50, 50, 50, 0, Math.PI * 2, 1);
  ctx.fill();
  ctx.beginPath();

  ctx.fillStyle = "skyblue";
  ctx.arc(80, 80, 50, 0, Math.PI * 2, 1);
  ctx.fill();

  ctx.clearRect(20, 40, 60, 20);
}