From 37cfdd15906cd502dbd4d338af4031c47540ccf0 Mon Sep 17 00:00:00 2001 From: Jay Wilson Jr Date: Sat, 7 Jul 2018 07:32:34 -0400 Subject: [PATCH 1/2] removed the answer from quiz two --- node/callbacks.quizz.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/node/callbacks.quizz.md b/node/callbacks.quizz.md index cdd30c1..48959f6 100644 --- a/node/callbacks.quizz.md +++ b/node/callbacks.quizz.md @@ -8,7 +8,10 @@ Make it run without errors but you cannot change the location of the `let` state function doAsyncTask(cb) { cb(); } -doAsyncTask(_ => console.log(message)); +setImmediate(() => { + doAsyncTask(_ => console.log(message)); +}) + let message = "Callback Called"; ``` @@ -22,20 +25,12 @@ const fs = require("fs"); function readFileThenDo(next) { fs.readFile("./blah.nofile", (err, data) => { - if (err) { - next(err); - } else { next(null, data); - } }); } readFileThenDo((err, data) => { - if (err) { - console.error(err); - } else { console.log(data); - } }); ``` From 922f39d88db8d3200b03c146cf19cef70363c582 Mon Sep 17 00:00:00 2001 From: Jay Wilson Jr Date: Sat, 7 Jul 2018 07:36:32 -0400 Subject: [PATCH 2/2] Removed the answer from quiz two --- node/callbacks.quizz.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/node/callbacks.quizz.md b/node/callbacks.quizz.md index 48959f6..6ca2c19 100644 --- a/node/callbacks.quizz.md +++ b/node/callbacks.quizz.md @@ -8,10 +8,8 @@ Make it run without errors but you cannot change the location of the `let` state function doAsyncTask(cb) { cb(); } -setImmediate(() => { - doAsyncTask(_ => console.log(message)); -}) +doAsyncTask(_ => console.log(message)); let message = "Callback Called"; ```