Does anyone know how can I make a sleep in javascript before next line been read by the system?
example:
1 var chkResult = Validation();
2 /
The delay won't happen until JavaScript has relinquished control back to the browser, so your line 4 will execute before the setTimeout starts.
You should be making everything happen based on events.
but this way, your line line will execute BEFORE line 4
setTimeout starts a separate execution "thread" within the JavaScript interpreter. You need to pass it a function and design your scripts in such a way that the function the setTimeout runs will continue where the calling function left off--thereby simulating a sleep.