From 27ea591adc5c8b131b83af20b398d65edcc5906b Mon Sep 17 00:00:00 2001 From: julienreszka Date: Tue, 13 Sep 2016 07:48:43 +0200 Subject: [PATCH] Added console log to make async more clear When someone tries the code, this person will see the different outputs, their order. This will make the purpose of async more clear. --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 883a57e..14eb64b 100644 --- a/readme.md +++ b/readme.md @@ -164,9 +164,11 @@ function addOne(callback) { function logMyNumber() { console.log(myNumber) + console.log("Done !"); } addOne(logMyNumber) +console.log("Doing some other stuff") ``` Now the `logMyNumber` function can get passed in as an argument that will become the `callback` variable inside the `addOne` function. After `readFile` is done the `callback` variable will be invoked (`callback()`). Only functions can be invoked, so if you pass in anything other than a function it will cause an error.