Work for game design using asynchronous functions in javascript