Skip to content

Commit 5557515

Browse files
authored
Update README.md
Some clarifications
1 parent 34549e3 commit 5557515

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,7 @@
15121512
15131513
51. ### What is a promise
15141514
1515-
A promise is an object that may produce a single value some time in the future with either a resolved value or a reason that it’s not resolved(for example, network error). It will be in one of the 3 possible states: fulfilled, rejected, or pending.
1515+
A promise is an object that may produce a single value some time in the future with either a resolved value or a reason that it’s not resolved (i.e. rejected, that means for example, due to a network error). It will be in one of the 3 possible states: fulfilled, rejected, or pending.
15161516
15171517
The syntax of Promise creation looks like below,
15181518
@@ -1581,7 +1581,7 @@
15811581
15821582
55. ### Why do we need callbacks
15831583
1584-
The callbacks are needed because javascript is an event driven language. That means instead of waiting for a response javascript will keep executing while listening for other events.
1584+
The callbacks are needed because javascript is an event driven language. That means instead of waiting for a response, javascript will keep executing while listening for other events.
15851585
Let's take an example with the first function invoking an API call(simulated by setTimeout) and the next function which logs the message.
15861586
15871587
```javascript
@@ -1597,7 +1597,7 @@
15971597
firstFunction();
15981598
secondFunction();
15991599

1600-
Output;
1600+
// Output:
16011601
// Second function called
16021602
// First function called
16031603
```
@@ -1626,7 +1626,7 @@
16261626
16271627
57. ### What are server-sent events
16281628
1629-
Server-sent events (SSE) is a server push technology enabling a browser to receive automatic updates from a server via HTTP connection without resorting to polling. These are a one way communications channel - events flow from server to client only. This has been used in Facebook/Twitter updates, stock price updates, news feeds etc.
1629+
Server-sent events (SSE) is a server push technology enabling a browser to receive automatic updates from a server via HTTP connection without resorting to polling. These are a one way communications channel - events flow from server to client only. This has been used in Facebook/Twitter/X updates, stock price updates, news feeds etc.
16301630
16311631
**[⬆ Back to Top](#table-of-contents)**
16321632
@@ -1683,7 +1683,7 @@
16831683

16841684
62. ### What is callback in callback
16851685

1686-
You can nest one callback inside in another callback to execute the actions sequentially one by one. This is known as callbacks in callbacks.
1686+
You can nest one callback inside in another callback to execute the actions sequentially one by one. This is known as callbacks in callbacks. Beware, too many levels of nesting lead to [Callback hell](https://github.com/ckpinguin/javascript-interview-questions/tree/master?tab=readme-ov-file#what-is-a-callback-hell)
16871687

16881688
```javascript
16891689
loadScript("/script1.js", function (script) {

0 commit comments

Comments
 (0)