0% found this document useful (0 votes)
4 views4 pages

Understanding JavaScript Promises

Uploaded by

rounakbhowmick
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)
4 views4 pages

Understanding JavaScript Promises

Uploaded by

rounakbhowmick
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

Page No.

Dato

L06s0n94_peomise, Basics
peomise_is _basicatky Something uhich_is
qOnna take Somttige to do.
so uHimattlu promise wi lead two Outuomes
fithee penise_ wi qet be sesolued ite. we
get the data we CWOht and is esolved
its gonna_be 1tiecked i.e we getOn_ekeo2
simple example_t_p£omisee
tgetsome thinq=()=7
n new F3omise[(1esolue,iciect)4
[ Rth sonething
solve('sone_Hota')

getSomethingC).then(Ldato)= A
[Link](data)_
his is N T t e -

Gome qFfa

simpleLxanple_of
ot_pomise_
onst qtSomething
etyan ned_yomise[(Lsolut, iciect)h
JRth ometding-
Htsolue ("some dita')
(Page No.
Date

qetSomethingt).then[Ldatu)=f
fons'ole logldato);_
([Link](eEE);_

This ishen_e
3ome eEEO

So his is pEomÍ ses in_actidn,_we eitheE gesofue


OE feiect somethin Ohd fAen fiee One_of tuo
funchionsdepended on thut
ih slead COn also_weÍR moee e0y (ode

(0nt qetmethinq=() =zL


detuin Peu flumise( Tiezolue 1eiect)4-
eject (lsome eetog');

qLtSonethin()-Hhen(düta =24
(01sole-loq[dato),
(onsole-loqleeey

(Same ouftput apove


s

nly eee vnat upe


hove is adoedCat7)
dhdwha (kTh do Otthes e EEOE)
Page No.

Data

heee fst_ugCeaKd_a_DeCU ilCClled


luigijson
Andin that_fik WEIk_below (ode

"Hxt":"donce" authoe"; "ligi"


"xt ":"pla "autho":"kigi?,
"Hxt" sin""CILHhoe" " luiqr

No inmCun_auUASYLE ile _weHR_balou) Ode_

fonst qetTodos= (ies0UECe)=74


HnNe_Komise((itsolue,eiece)_
onst 1eqlEst =new_XMLHHApRequestt)1
[Link] eYeadystaktdhnge' )=zL
funst datde J50N-atse(rquestitspopseTPkt)
solue ldata)_
els it(equest0adyustak eas4)4
1iect (eEEOE etfing sue L

[Link]("GET, 15e)
QUMst: stnd [ ) _
(Page No
Date

getTodos( luigi:json')tHen{dota=
(Msole-log e1ose_eso{ued:\ dot@)_
L) [Link]ée
[Link] p1omise eieted:et

pruCise esolued:() (

And (when we Chunge in_qetTdos


i qet Todos('luigiijson)then_[data =y
SUKR FTtë-
giHA Uong
Some
code a5 TUTOU ee we( a t t d - u u g i j s o

nly we chonqe Uutput have


M guin
f e we hrettwe
l i 5onethissovKe
ahd

tEedeessaqe o r
GET http:!/ _ ou(tot fouhd prttt utssu b e
MTISe 1ejtcked 2ettog qetting promise
wll
&esoine /ou

You might also like