Jingshao

Timeout

Background Javascript is async in nature. An operation can be put to wait to give up execution time. During this yield time, other operations such as GUI updates, can be run. Besides IO bounded operations, the simplest way to put an action into wait to be executed later is setTimeout. setTimeout(action, 1000) will run action after 1 second. And the program can run whatever during this 1 second wait time. It is like a breathe time for the program. Read more →