r/javascript • • Apr 13 '17

help Challenge: Dutch flag on canvas

I've got an interesting challenge: Make an .html file and use a canvas to draw the dutch flag in as few characters as possible. The least I've managed to do so far is 213 characters:

<canvas id="p" width="6" height="3"></canvas>
<script type="text/javascript">
c=document.getElementById("p");
t=c.getContext("2d");
t.fillStyle="red";
t.fillRect(0,0,6,1);
t.fillStyle="blue";
t.fillRect(0,2,6,1)
</script>
7 Upvotes

23 comments sorted by

View all comments

Show parent comment

1

u/lhorie Apr 13 '17

Because while that works in jsfiddle etc, it does not work in a plain HTML file, so it doesn't match the challenge criteria: "Make an .html file"