-2
function countDown(){
    var count = ""
for(var i = 10; i > 0; i--){

    count = i;

    setInterval(function(){show(count)}, 1000);

      // i've try : setInterval(show(count), 1000);
    }   
}


function show(count){
        document.getElementById('tes').innerHTML = count;
    }

don't flag as duplicate, this is different thing!! This is just experiment,

Robin
  • 59
  • 1
  • 8

1 Answers1

0

The code should be

function countDown(){
    var count = "";
for(var i = 10; i > 0; i--){

    count = i;

    setInterval(show(count), 1000); //call function, do not create one here

      // i've try : setInterval(show(count), 1000);
    }   
}


function show(count){
        document.getElementById('tes').innerHTML = count;
    }

countDown(); //invokation
Bikas
  • 2,709
  • 14
  • 32