Javascript Timer count down

Javascript code to countdown timer from 3 seconds.

<!DOCTYPE html>
<html>
<style>
#adsTimer{
	padding:4px;
	font-size: 2em;
    display: inline-block;
  	width: 95px;
    color: #fff;
    background-color: #ff0000;
    border: 2px solid #ff0000;
    border-radius: 2px;
}
</style>
<body>

<span id="adsTimer"></span>

<script>
var timeLeft = 10;
var elem = document.getElementById('adsTimer');
var adsTimer = setInterval(countdown, 1000);

 

function countdown() {
    if (timeLeft == 0) {
        clearTimeout(adsTimer);
        endOfTimer();
        
    } else {
        elem.innerHTML = timeLeft + ' secs';
        timeLeft--;
    }
}

function endOfTimer() {
    elem.style.display = "none";
}
</script>
</body>
</html>