console
function drawRect(cxt,x,y,width,height,fillColor,borderWidth,borderColor){
cxt.beginPath();
cxt.rect(x,y,width,height);
cxt.lineWidth = borderWidth;
cxt.strokeStyle = borderColor;
cxt.fillStyle = fillColor;
cxt.fill();
cxt.stroke();
}
var canvas = document.getElementById("canvas");
canvas.width = 700;
canvas.height = 700;
var context = canvas.getContext("2d");
let x = y = 50;
let width = height = 300;
while (width>0)
{
width -= 10;
height -=10;
x += 5;
y += 5;
drawRect(context,x,y,width,height,'#000',2,'#fff')
}
<canvas id="canvas"></canvas>