JS – Async question 1 ..

Make it run without errors but you cannot change the location of the `let` statement, that has to stay at the end.

This was a trick question.

Callbacks are not async by default, this was a sync call so the message var was not defined by the time the callback was called.To make this work we need to wrap our call to `cb` in either a `setImmediate` or a `process.nextTick`.

Leave a Reply

Your email address will not be published. Required fields are marked *