settimeout - Javascript: Display Changing Text From Array -
i need function function1()
select text array
var array1 = ['bla','blaa','blabla','la',]; var result1 = array1[math.floor(math.random() * array1.length)];
multiple times
var array1 = ['bla','blaa','blabla','la',]; var result1 = array1[math.floor(math.random() * array1.length)]; var result2 = array1[math.floor(math.random() * array1.length)];
and display result1
document.getelementbyid("paragraph").textcontent = result1 ;
then wait using settimeout wait 1 second , display second result
document.getelementbyid("paragraph").textcontent = result2 ;
can combine these unfinished pieces of code , convert working function settimeout command.
you got way , couldnt last bit?
document.getelementbyid("paragraph").textcontent = result1 ; settimeout(function(){ document.getelementbyid("paragraph").textcontent = result2 ; },1000);
Comments
Post a Comment