"Synchronous" means that one thing happens after another. It's probably the simplest way to program. The events of line 11 will always happen after line 10.
"Asynchronous" means that the events of line 11 might begin before the events of line 10 complete. JavaScript is generally synchronous, but allows for asynchronous functionality. Things like fetching the results of a web request are often done asynchronouslyβ And for good reason. If you need to fetch data from a URL, it is not very efficient to wait around doing nothing while the request is sent and returned. Where possible, it's good if other code can execute. For example, I may also want to respond to a separate click event while I wait.
All in all, reconciling async code can be complicated. JavaScript has several ways to accomplish sane async programming. Check out this explanation of promises and async/await for more info.
For further actions, you may consider blocking this person and/or reporting abuse
"Synchronous" means that one thing happens after another. It's probably the simplest way to program. The events of line 11 will always happen after line 10.
"Asynchronous" means that the events of line 11 might begin before the events of line 10 complete. JavaScript is generally synchronous, but allows for asynchronous functionality. Things like fetching the results of a web request are often done asynchronouslyβ And for good reason. If you need to fetch data from a URL, it is not very efficient to wait around doing nothing while the request is sent and returned. Where possible, it's good if other code can execute. For example, I may also want to respond to a separate
click
event while I wait.All in all, reconciling async code can be complicated. JavaScript has several ways to accomplish sane async programming. Check out this explanation of promises and async/await for more info.