0% found this document useful (0 votes)
51 views8 pages

Promises in JS

Javascript promises
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views8 pages

Promises in JS

Javascript promises
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Promises

in JS

www.scribbler.live
What are Promises ?
Promises represent operations that
haven't been completed yet but will
either be successful or unsuccessful.

Promises streamline asynchronous


programming in JavaScript, making it
easier to write and maintain code that
deals with time-consuming tasks.
Simple Example
Imagine you order pizza online, and the
website promises to deliver it soon.

You don't wait around staring at the


door; instead, you go about your
business.

When the pizza arrives, you're notified.


That's how promises work in JavaScript!
Where are Promises
Applied?

1 HTTP REQUESTS

2 FILE OPERATIONS

3 TIMEOUTS AND DELAYS

4 CONCURRENCY

5 PARALLELISM
Creating a Promise
Consuming a Promise
Asynchronous Operation
with a Promise
Keep Exploring
Javascript
with us!
Share this with a friend who needs it and
make sure to practice these in scribbler.

Scribbler.live
Free and Open Interface to
experiment JavaScript

You might also like