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

// Example 1 - Synchronous (blocks)
var result = database.query("SELECT * FROM hugetable");
console.log("Query finished");
console.log("Next line");


// Example 2 - Asynchronous (doesn't block) 
database.query("SELECT * FROM hugetable", function(result) {
    console.log("Query finished");
});
console.log("Next line");