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); 

docs settimeout


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -