setInterval, clearInterval

Just trying out some stuff with those two.

HTML

<div id="console">
    <button onclick="stopMyInterval()">Stop</button>    
        
</div>

CSS

body { margin:0; padding:0 }
#console {
    width: 100%;
    height: 100%;
    position: fixed;
    overflow: auto;
    background: #000;
    color: #0F0;
    font-family: monospace;
    font-size: 12px;
    padding: 5px;
}
button {
    border: solid 1px #090;
    background: #020;
    color: #0F0;
}

JavaScript

var console = {
    log: function(logContent) {
        document.getElementById('console').innerHTML += "<br />" + logContent;
    }
};
var a = 1;
var myInterval = 0;
function myIntervalFunction() {
 

}
function stopMyInterval() {
    clearInterval(myInterval);
}

myInterval = setInterval(
    function() {
        console.log('test ' + a);
        a += 1;    
    }, 1000);