How to wait few seconds to execute the next line in Javascript?
Question
Like title says, how to wait, let’s say 5 seconds, to execute the next line in javascript?
Answer
First, create a wait function to freeze the code:
1 | function wait(ms){ |
Insert wait
function into your code, the paramemter is millisecond.
1 | console.log('before'); |
Reference
This is the end of post