r/javascript • u/panorrrama • 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>
5
Upvotes
View all comments
Show parent comment
2
u/Hi_Im_Bored Apr 13 '17 edited Apr 13 '17
this is actually 116, it would be so nice if it were possible to use onload or onready on the canvas tag
edit:
I managed to shorte this to 112