concept of structured asynchronous programming (JS version)