I tried to code a snake game in my second day of coding. But the white color isn't showing up i reloaded the page a few times and it didn't work.
This is the code:
<canvas id="canvas" width="720" height="480"></canvas>
<script>
let canvas = document.getElementById('canvas');
let ctx = canvas.getContext('2d');
draw();
function draw() {
ctx.fillstyle = 'black';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillstyle = 'white';
ctx.fillRect(100, 150, 30, 30);
}
function gameLoop() {
}
</script>