JS — Callback hell
Callback Hell
what is callback hell?
Callback Hell, also known as Pyramid of Doom, is an anti-pattern seen in code of asynchronous programming.

It is a slang term used to describe and unwieldy number of nested “if” statements or functions.
below picture is also example of callback hell

Let’s make some functions that print something see the below

let’s try on the browser.

open index.html you will see this message


if you put right ‘id’ and ‘password’
this message will show up.

successful!
if you put ‘wrong’ info then this Error message show up on the console.

but there is problem about callback hell in this code.
the main issue is readability. when this callback chain getting longer and longer. it will be harder and harder to find where the error is.
I will talk about more about promise and async and await for next story.
Thank you