Edit in JSFiddle

var canvas = document.getElementById('canvas');
if (canvas.getContext) {
    var ctx = canvas.getContext('2d');
    ctx.fillStyle = "white";
    ctx.fillRect(30,30,2,2);
}
<body>
    <canvas id="canvas" width="400" height="300"></canvas>
</body>
#canvas {
    background-color:black
}