Intermediate
Promise helpers: delay and a promisified API
1. Write delay(ms, value): it returns a promise that fulfils with value after ms milliseconds.
2. readConfig(name, callback) is an old error-first callback API (don't change it). Write readConfigAsync(name) that returns a promise: fulfilled with the config, or rejected with the error the callback received.
What Check tests
delayreturns a promisedelay(150, "hi")fulfils withhiafter at least 150 msreadConfigAsync("app")fulfils with the configreadConfigAsync("db")rejects with the original error
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.