2024-02-04T06:23:58.195Z
nova-2
2-general-nova
2024-01-09.29447
30089e05-99d1-4376-b32e-c263170674af
9d301045-413c-4415-8bd5-42a049480555
5da47d8d8ef60651bcae0cbc1ec81b627fc7286f9a27a8e590aeba3cde8bb4d1
67875a7f-c9c4-48a0-aa55-5bdb8a91c34a
deprecated
A Promise represents a value that is unknown now, that may become known in the future.
In other words, an asynchronous value.
Think of it like a ride hailing app.
When you request a ride, the driver makes a promise to pick you up.
While you're waiting, the ride is pending.
In the future, if all goes according to plan, the driver will resolve to pick you up, then take you somewhere, at which point your ride has been fulfilled.
But, in some cases, the driver might reject your ride, in which case you'll need to catch one somewhere else.
Either way, the original request is now finally settled.
As a developer, you might want to create a Promise to represent an asynchronous value.
But, more often than not, you'll be consuming promises to use the result of an asynchronous operation in your code.
On the left, we're making promises.
To on the right where using them.
When constructed, a Promise starts off in a Pending state.
It's your job to define a callback function, called an Executor, that defines when to resolve or reject the Promise.
This is where you would kick off your asynchronous work.
On the other side, the consumer of the Promise has called its Then method.
It's waiting for the asynchronous value to be fulfilled.
When that happens, we'll call this function with the value as its argument.
We fulfill the promise by calling resolve, but there's always the possibility of an exception.
In that case, we can reject the promise and send the error back down to the consumer, which can use the catch method and an entirely different function for handling option.
And if you just want to run some code no matter what, you can use finally to handle both possibilities.
All of these methods return promises, which means they can be chained together to handle multiple asynchronous operations in a row.
This has been JavaScript Promises in 100 seconds.
Thanks for watching and also make sure to follow my brand new Instagram account for even more content on this topic.
I will see you in the next one.

Speaker 0: A Promise represents a value that is unknown now, that may become known in the future. In other words, an asynchronous value. Think of it like a ride hailing app. When you request a ride, the driver makes a promise to pick you up. While you're waiting, the ride is pending.

In the future, if all goes according to plan, the driver will resolve to pick you up, then take you somewhere, at which point your ride has been fulfilled. But, in some cases, the driver might reject your ride, in which case you'll need to catch one somewhere else. Either way, the original request is now finally settled. As a developer, you might want to create a Promise to represent an asynchronous value. But, more often than not, you'll be consuming promises to use the result of an asynchronous operation in your code.

On the left, we're making promises. To on the right where using them. When constructed, a Promise starts off in a Pending state. It's your job to define a callback function, called an Executor, that defines when to resolve or reject the Promise. This is where you would kick off your asynchronous work.

On the other side, the consumer of the Promise has called its Then method. It's waiting for the asynchronous value to be fulfilled. When that happens, we'll call this function with the value as its argument. We fulfill the promise by calling resolve, but there's always the possibility of an exception. In that case, we can reject the promise and send the error back down to the consumer, which can use the catch method and an entirely different function for handling option.

And if you just want to run some code no matter what, you can use finally to handle both possibilities. All of these methods return promises, which means they can be chained together to handle multiple asynchronous operations in a row. This has been JavaScript Promises in 100 seconds. Thanks for watching and also make sure to follow my brand new Instagram account for even more content on this topic. I will see you in the next one.
A Promise represents a value that is unknown now, that may become known in the future. In other words, an asynchronous value. Think of it like a ride hailing app.
When you request a ride, the driver makes a promise to pick you up. While you're waiting, the ride is pending. In the future, if all goes according to plan, the driver will resolve to pick you up, then take you somewhere, at which point your ride has been fulfilled.
vehicles
electric vehicles
automobiles
transportation
But, in some cases, the driver might reject your ride, in which case you'll need to catch one somewhere else. Either way, the original request is now finally settled. As a developer, you might want to create a Promise to represent an asynchronous value. But, more often than not, you'll be consuming promises to use the result of an asynchronous operation in your code.
On the left, we're making promises. To on the right where using them. When constructed, a Promise starts off in a Pending state. It's your job to define a callback function, called an Executor, that defines when to resolve or reject the Promise. This is where you would kick off your asynchronous work.
construction
On the other side, the consumer of the Promise has called its Then method. It's waiting for the asynchronous value to be fulfilled. When that happens, we'll call this function with the value as its argument. We fulfill the promise by calling resolve, but there's always the possibility of an exception. In that case, we can reject the promise and send the error back down to the consumer, which can use the catch method and an entirely different function for handling option. And if you just want to run some code no matter what, you can use finally to handle both possibilities. All of these methods return promises, which means they can be chained together to handle multiple asynchronous operations in a row.
This has been JavaScript Promises in 100 seconds. Thanks for watching and also make sure to follow my brand new Instagram account for even more content on this topic. I will see you in the next one.
instagram
A Promise represents a value that is unknown now, that may become known in the future. In other words, an asynchronous value. Think of it like a ride hailing app. When you request a ride, the driver makes a promise to pick you up. While you're waiting, the ride is pending. In the future, if all goes according to plan, the driver will resolve to pick you up, then take you somewhere, at which point your ride has been fulfilled. But, in some cases, the driver might reject your ride, in which case you'll need to catch one somewhere else. Either way, the original request is now finally settled. As a developer, you might want to create a Promise to represent an asynchronous value. But, more often than not, you'll be consuming promises to use the result of an asynchronous operation in your code. On the left, we're making promises. To on the right where using them. When constructed, a Promise starts off in a Pending state. It's your job to define a callback function, called an Executor, that defines when to resolve or reject the Promise. This is where you would kick off your asynchronous work. On the other side, the consumer of the Promise has called its Then method. It's waiting for the asynchronous value to be fulfilled. When that happens, we'll call this function with the value as its argument. We fulfill the promise by calling resolve, but there's always the possibility of an exception. In that case, we can reject the promise and send the error back down to the consumer, which can use the catch method and an entirely different function for handling option. And if you just want to run some code no matter what, you can use finally to handle both possibilities. All of these methods return promises, which means they can be chained together to handle multiple asynchronous operations in a row. This has been JavaScript Promises in 100 seconds. Thanks for watching and also make sure to follow my brand new Instagram account for even more content on this topic. I will see you in the next one.
A
a
Promise
promise
represents
represents
a
a
value
value
that
that
is
is
unknown
unknown
now,
now
that
that
may
may
become
become
known
known
in
in
the
the
future.
future
In
in
other
other
words,
words
an
an
asynchronous
asynchronous
value.
value
Think
think
of
of
it
it
like
like
a
a
ride
ride
hailing
hailing
app.
app
When
when
you
you
request
request
a
a
ride,
ride
the
the
driver
driver
makes
makes
a
a
promise
promise
to
to
pick
pick
you
you
up.
up
While
while
you're
you're
waiting,
waiting
the
the
ride
ride
is
is
pending.
pending
In
in
the
the
future,
future
if
if
all
all
goes
goes
according
according
to
to
plan,
plan
the
the
driver
driver
will
will
resolve
resolve
to
to
pick
pick
you
you
up,
up
then
then
take
take
you
you
somewhere,
somewhere
at
at
which
which
point
point
your
your
ride
ride
has
has
been
been
fulfilled.
fulfilled
But,
but
in
in
some
some
cases,
cases
the
the
driver
driver
might
might
reject
reject
your
your
ride,
ride
in
in
which
which
case
case
you'll
you'll
need
need
to
to
catch
catch
one
one
somewhere
somewhere
else.
else
Either
either
way,
way
the
the
original
original
request
request
is
is
now
now
finally
finally
settled.
settled
As
as
a
a
developer,
developer
you
you
might
might
want
want
to
to
create
create
a
a
Promise
promise
to
to
represent
represent
an
an
asynchronous
asynchronous
value.
value
But,
but
more
more
often
often
than
than
not,
not
you'll
you'll
be
be
consuming
consuming
promises
promises
to
to
use
use
the
the
result
result
of
of
an
an
asynchronous
asynchronous
operation
operation
in
in
your
your
code.
code
On
on
the
the
left,
left
we're
we're
making
making
promises.
promises
To
to
on
on
the
the
right
right
where
where
using
using
them.
them
When
when
constructed,
constructed
a
a
Promise
promise
starts
starts
off
off
in
in
a
a
Pending
pending
state.
state
It's
it's
your
your
job
job
to
to
define
define
a
a
callback
callback
function,
function
called
called
an
an
Executor,
executor
that
that
defines
defines
when
when
to
to
resolve
resolve
or
or
reject
reject
the
the
Promise.
promise
This
this
is
is
where
where
you
you
would
would
kick
kick
off
off
your
your
asynchronous
asynchronous
work.
work
On
on
the
the
other
other
side,
side
the
the
consumer
consumer
of
of
the
the
Promise
promise
has
has
called
called
its
its
Then
then
method.
method
It's
it's
waiting
waiting
for
for
the
the
asynchronous
asynchronous
value
value
to
to
be
be
fulfilled.
fulfilled
When
when
that
that
happens,
happens
we'll
we'll
call
call
this
this
function
function
with
with
the
the
value
value
as
as
its
its
argument.
argument
We
we
fulfill
fulfill
the
the
promise
promise
by
by
calling
calling
resolve,
resolve
but
but
there's
there's
always
always
the
the
possibility
possibility
of
of
an
an
exception.
exception
In
in
that
that
case,
case
we
we
can
can
reject
reject
the
the
promise
promise
and
and
send
send
the
the
error
error
back
back
down
down
to
to
the
the
consumer,
consumer
which
which
can
can
use
use
the
the
catch
catch
method
method
and
and
an
an
entirely
entirely
different
different
function
function
for
for
handling
handling
option.
option
And
and
if
if
you
you
just
just
want
want
to
to
run
run
some
some
code
code
no
no
matter
matter
what,
what
you
you
can
can
use
use
finally
finally
to
to
handle
handle
both
both
possibilities.
possibilities
All
all
of
of
these
these
methods
methods
return
return
promises,
promises
which
which
means
means
they
they
can
can
be
be
chained
chained
together
together
to
to
handle
handle
multiple
multiple
asynchronous
asynchronous
operations
operations
in
in
a
a
row.
row
This
this
has
has
been
been
JavaScript
javascript
Promises
promises
in
in
100
100
seconds.
seconds
Thanks
thanks
for
for
watching
watching
and
and
also
also
make
make
sure
sure
to
to
follow
follow
my
my
brand
brand
new
new
Instagram
instagram
account
account
for
for
even
even
more
more
content
content
on
on
this
this
topic.
topic
I
i
will
will
see
see
you
you
in
in
the
the
next
next
one.
one
success
The speaker explains that promises represent an asynchronous value that may never be known in the future. As a developer, one can create a Promise to represent the value in the future and use it for various asynchronous operations. The process of resolving a call back using promises is handled through execution of the honor method, which requires the use of the original method and the chaining of multiple promises.
JavaScript Promise in 100 Seconds
Learn JavaScript Promises in 100 seconds, then follow my new IG account for even more content https://www.instagram.com/fireship_dev/

Reference MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

#javascript #100SecondsOfCode

Upgrade to Fireship PRO at https://fireship.io/pro
Use code lORhwXd2 for 25% off your first payment. 

My VS Code Theme

- Atom One Dark 
- vscode-icons
- Fira Code Font