Need help putting this javascript into this HTML code ( i'm new to coding )
<img id="coin"/><br/>
<button id="toss">Toss</button><br/>
<div id="count"></div>
HTML ^
var current = 3;
var elem = document.getElementById('toss');
var intervalId = setInterval( function(){
if( current > 0 ){
elem.innerHTML = "<h1>" + current + "</h1>";
} else {
if( Math.random() > .5 ){
elem.innerHTML = '<img src="http://csgowild.com/assets/images/terrorist.png">';
} else {
elem.innerHTML = '<img src="http://vignette1.wikia.nocookie.net/cswikia/images/4/4c/Csgo_CT_icon_alt.png/revision/latest?cb=20151222191721">';
}
clearInterval( intervalId );
}
current--;
}, 1000 ); // 1000 ms = 1s
Javascript ^