<meta charset="UTF-8">
<canvas width="600" height="400">
</canvas>
<script>
function desenhaTriangulo(){
}
function desenhaEsquadro(xa, ya, xc, yc, cor){
var tela = document.querySelector('canvas');
var pincel = tela.getContext('2d');
pincel.fillStyle = cor;
pincel.beginPath();
pincel.moveTo(xa, ya);
pincel.lineTo(xa, yc);
pincel.lineTo(xc, yc);
pincel.fill();
pincel.fillStyle = 'white';
pincel.beginPath();
pincel.moveTo(xa + 50, ya + 125);
pincel.lineTo(xa + 50, yc - 50);
pincel.lineTo(xc - 125, yc - 50);
pincel.fill();
}
desenhaEsquadro(0,0,400,400,'green');
</script>