1function processData (callback) {
2 fetchData(function (err, data) {
3 if (err) {
4 console.log("An error has occurred. Abort everything!");
5 return callback(err);
6 }
7 data += 1;
8 callback(null, data);
9 });
10}
11
12processData(function (err, data) {
13 if (err) {
14 console.err(err);
15 } else {
16 console.log("Data: " + data);
17 }
18});