diff --git a/README.md b/README.md
index fdae8f6..3bc019c 100644
--- a/README.md
+++ b/README.md
@@ -2107,6 +2107,136 @@ btn.addEventListener('click', clickHandler.handleClick.bind(clickHandler));
+### 48. How to replace callbackhell with Promise or Async/Await with examples ?
+
+Answer
+
+- Part I Callbackhell.
+- Calling one callback function inside another and so on is callbackhell.
+- First we are defining three functions addTen, subFive and mulTwo.
+- These three functions while called with a number, will return a callback.
+- The callback function will return either result or error.
+
+```js
+const addTen = (num, callback) =>
+ {return callback(num+10, false)}
+```
+
+```js
+const subFive = (num, callback) =>
+ {return callback(num-5, false)}
+```
+
+```js
+const mulTwo = (num, callback) =>
+ {return callback(num*2, false)}
+```
+
+- Now lets call these one by one in nested way.
+- The result of previous will serve as input for next callback.
+
+```js
+const ans = addTen(5, (addRes, addErr) => { // addRess = 15
+ if(!addErr)
+ {
+ return subFive(addRes , (subRes, subErr) => { //subRes = 10
+ if(!subErr){
+ return mulTwo(subRes, (mulRes, mulErr) => {
+ if(!mulErr)
+ {
+ return mulRes; //20
+ }
+ })
+ }
+ })
+ }
+ })
+console.log(ans); // 20
+```
+
+- Part II Promise.
+- Promise has two parameters resolve and reject.
+- Rewrting those three function definations as well, without a callback.
+
+```js
+const addTen = (num) => {return num+10}
+```
+
+```js
+const subFive = (num) => {return num-5}
+```
+
+```js
+const mulTwo = (num) => {return num*2}
+```
+
+- Creating a promise.
+
+```js
+const promise = new Promise((resolve, reject) => {
+ if(true)
+ resolve(5)
+ else
+ reject("Something went wrong ")
+})
+```
+
+- Calling those three functions one by one.
+- "then" will keep on returning the result and if any error "catch" will catch it.
+
+```js
+promise.then(addTen).then(subFive).then(mulTwo).then((ans)=>{
+console.log(ans)
+}).catch((err)=>{console.log(err)});
+```
+
+- Part III Async / Await.
+- It actually uses promise internally.
+
+```js
+const addTen = ( num ) => {
+ return new Promise( ( resolve, reject ) => {
+ resolve( num+10)
+ } )
+}
+```
+
+```js
+const subFive = ( num ) => {
+ return new Promise( ( resolve, reject ) => {
+ resolve( num-5)
+ } )
+}
+```
+
+```js
+const mulTwo = ( num ) => {
+ return new Promise( ( resolve, reject ) => {
+ resolve( num*2)
+ } )
+}
+```
+
+- Put Async keyword before function name and Await before the statments inside the function
+- Await will make the later code wait until the result of that statement is returned.
+- Always put this inside a try/catch block.
+
+```js
+const ans = async (num) => {
+ try {
+ var addRes = await addTen(num);
+ var subRes = await subFive(addRes);
+ var mulRes = await mulTwo(subRes);
+ console.log(mulRes)
+ } catch (err) {
+ console.log(err)
+ }
+}
+ans(5)
+```
+
+
+
# Coding Questions
## Passing values by reference vs by value
@@ -3120,7 +3250,9 @@ console.log(funcA());
Answer
- 1)
+ 1) funcA Window {...}
+ innerFunc1 Window {...}
+ innerFunA11 Window {...}
@@ -3910,6 +4042,41 @@ personObj.getName2();
+### 8 . What would be the output of the following code ?
+```javascript
+let a = true;
+let c = 0;
+
+setTimeout(() => {
+ a = false;
+},2000)
+
+while(a){
+ console.log('Hello')
+}
+```
+Answer
+The above program will print Hello infinitely. Since, Javascript is a single threaded language the actual execution happens only on the main thread. So, setTimeout will wailt for 2000 milliseconds on a seperate thread as while loop has occupied the main thread. The exit condition for the loop is to set the variable a as fasle. But as the loop continously running on the main thread , it a cannot be set false.
+
+
+### 9 . What would be the output of the following code ?
+```javascript
+
+let c=0;
+
+let id = setInterval(() => {
+ console.log(c++)
+},200)
+
+setTimeout(() => {
+ clearInterval(id)
+},2000)
+```
+
+Answer
+The above program will print 0 to 9 sequentially.
+
+
## Contributing
We always appreciate your feedback on how the book can be improved, and more questions can be added. If you think you have some question then please add that and open a pull request.