Я пытаюсь нарисовать пустой черный прямоугольник на экране для своего холста, чтобы я мог начать делать свою игру в понг, но ничего не вижу?
Я проверил, нет ли ошибокно я не
html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jatt the maquebla</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
</head>
<body>
<canvas id="pong" width="600" height="400"></canvas>
<script src="App.js"></script>
</body>
</html>
javascript:
// select the canvas that we have made in our html file
const cvs = document.getElementById("pong");
const ctx = cvs.getContext("2d");
// draw our rectangle function
function drawRect(x, y, w, h, color) {
ctx.fillStyle = color;
ctx.fillRect(x,y,w,h);
}
drawRect(0, 0, cvs.wdith, cvs.height, "BLACK");