Not sure what is wrong. The blue color defined by variable “color” doesn’t show. Always get default color black.
<body>
<canvas width="480" height="320">
</canvas>
<script>
let canvas = document.querySelector('canvas');
let ctx = canvas.getContext('2d');
let x = 50;
let y = 60;
let width = 100;
let height = 75;
let color = 'blue';
canvas.innerHTML= '';
ctx.fillRect(x, y, width, height);
ctx.fillStyle = color;
</script>
</body>