Skip to content

Instantly share code, notes, and snippets.

@Yan0983007
Last active March 14, 2018 04:14
/*
*
* Display an console log after 3 seconds (3000 milliseconds)
* 功能:進入setTimeout三秒後再顯示一行字
*
*/
setTimeout(function(){ console.log("wait after 3 seconds!"); }, 3000); // 等待三秒後輸出
console.log("Hi!"); // 由於setTimeout是非同步函數,因此執行的同時便接著執行這行,導致這行先輸出
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment