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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -