Skip to content

Commit b677fe0

Browse files
committed
promise
1 parent bb8f016 commit b677fe0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

javascript-developer/js/advanced/async/promises.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ title: Promises javascript
55
toc_max: 4
66
---
77

8+
In JavaScript, a promise is an object that represents the eventual completion (or failure) of an asynchronous operation. Promises provide a simpler way to handle asynchronous operations compared to using callbacks, and they are often used with async/await.
9+
10+
A promise has a few key properties:
11+
12+
* It represents the result of an asynchronous operation, which can be a success (resolved) or a failure (rejected).
13+
* It has a then method that allows you to specify callback functions for handling the successful completion or failure of the asynchronous operation.
14+
* It has a catch method that allows you to specify a callback function for handling any errors that may occur during the asynchronous operation.
15+
816
`promise` is `alternative` of `callback` . Promise is Asynchronous.
917

1018
### promise has 3 states

0 commit comments

Comments
 (0)