Hot answers tagged

3

This code is WET (wrote everything twice) and hard to extend/reuse. What if you want to ask, say, 10 questions? How about 100? Following the original design would likely create a pyramid of doom. We can DRY it out and flatten the pyramid with promises and a loop: const readline = require("readline"); const rl = readline.createInterface({ input: ...


2

As @JaeBradley says, the out-of-memory error doesn't seem to have anything to do with the function you want to to have reviewed, so I'll just do a regular review, but I've added some words about this at the end. Code style Personally I'm not a big fan of using the lambda notation to define top-level functions. Using the function keyword makes the purpose of ...


2

Overfall feedback This review will mostly focus on the usage of JavaScript features used and not so much on the actual algorithm. The code has many repeated lines/blocks, which violates the Don't Repeat Yourself principle. For example, the following block appears at least five times, sometimes wrapped in a call to setTimeout(): access(key,function(newData){...


Only top voted, non community-wiki answers of a minimum length are eligible