Hi guys I've got a nice code in javascript which writes some characters on the HTML5 Canvas, I want to count the characters on the canvas.
If the canvas counts more then 10.000 characters I want the script to clear the interval.
Here is my code:

```
    <script>
        window.onload=function(){
        var lin2=200; // sets the vertical size to 200
        setInterval(function(){
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.strokeStyle="black"; //sets the stroke color
ctx.font="20px Georgia"; //set's up the font type and size
ctx.fillStyle="lime";
ctx.fillText(Math.floor(Math.random() * (1 - 0 + 1)) + 0,Math.floor(Math.random() * (1000 - 1 + 1)) + 1,lin2); //return's random 1 or 0 with random width and lin2 width
ctx.beginPath();
ctx.moveTo(500,0);
ctx.shadowColor="blue"; // not necessary
ctx.stroke();
var url = c.toDataURL();document.getElementById("mywork").innerHTML="<img src=\""+url+"\"></img>"; // draw it on the canvas
lin2++;  //lin2 +1
if(lin2 > 1200){ //if the vertical height equals the height of the canvas set the vertical heigth to zero.
lin2=0;
}
},0.1); //time delay
        };
    </script>

```