Understanding Synchronous vs Asynchronous JavaScript