Callbacks vs. Promises vs. Async
Get a refresher on the concepts of callbacks, promises, and async side by side.
We'll cover the following...
As a refresher on the techniques that we have explored, let’s compare the techniques used when using callbacks, Promises, and async await all in one go.
Callback
First up, the callback syntax is as follows:
Press + to interact
callback_vs_promise_vs_async.ts
tsconfig.json
{"compilerOptions": {"target": "ES2015","module": "commonjs","strict": false,"esModuleInterop": true,"skipLibCheck": true,"forceConsistentCasingInFileNames": true}}
Here, we define a function named usingCallbacks
. Within this function,
we define two more functions named afterCallbackSuccess
and
...