console aparece erro na linha do getContext
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>test</title>
</head>
<body>
<canvas width="600" height="400"></canvas>
<script>
var tela = document.getElementById("canvas")
var pincel = tela.getContext("2d");
pincel.fillStyle = 'ligthgrey'
pincel.fillRect(0,0,600,400);
</script>
</body>
</html>