How to synchronize I/O in JavaScript | Hacker News Reader