asynchronous code vs synchronous code code example
Example 1: async vs sync
synchronous (sync) - you can only execute one thing at a time
asynchronous (async) - you can execute multiple things at the same time
Example 2: difference between synchronous and asynchronous in node js
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");