difference between synchronous and asynchronous way of communication code example
Example 1: what is synchronous communication
Synchronous communication happens when messages can only be exchanged in
real time. It requires that the transmitter and receiver are present in
the same time and/or space. Examples of synchronous communication are
phone calls or video meetings.
Example 2: synchronous vs asynchronous functions javascript
var result = database.query("SELECT * FROM hugetable");
console.log("Query finished");
console.log("Next line");
database.query("SELECT * FROM hugetable", function(result) {
console.log("Query finished");
});
console.log("Next line");