A-synchronous callback && promises
SYNCHRONOUS CODE Synchronous basically means that you can only execute one thing at a time. JS is a single-threaded means that can only execute one code at a time therefore the order is guaranteed. C ode executes step by step in order: SYNCHRONOUS CODE: BLOCKING STATE AND SLOW PERFORMANCE posts = loadpostsync (); // wait tills posts are fetched dotheNextthing )(); // has to wait until posts are fetched A - SYNCHRONOUS CODE: NON - BLOCKING STATE AND FAST PERFORMANCE posts = loadpostsync ( function () { // wait till posts are fetched // .. do something with posts }); dotheNextthing )(); // doesnothave to wait until posts are fetched What if certain operations take a bit longer??? We simply have certain operations that cannot be finished immediately. It, not ju...