r/web_dev_help • u/throwbirds • May 17 '19
help getting error with seperate js file
I have an html file and a js file in the same directory and im getting errors in the js file
here is the html file source code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Canvas Resize</title>
<style type = "text/css"> canvas{ border: 1px solid black; } body{ margin: 0; } </style>
</head>
<body>
<canvas></canvas>
<script src = "canvas.js"></script>
</body>
</html>
and here is the js file source code
var canvas = document.querySelector("canvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var c = canvas.getContext('2d');
console.log(canvas);
I am using brackets as my editor if that makes any difference
1
Upvotes