0% found this document useful (0 votes)
20 views32 pages

JavaScript Event Handling and Prototypes

Uploaded by

nishant.jpis
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)
20 views32 pages

JavaScript Event Handling and Prototypes

Uploaded by

nishant.jpis
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

Cont handlen 2 =() >

Lmoole ("Buton l was icked -hondn


bhn l addCvent- lintnen (1cick, honden),
btn|: emove Even-lstenes ("cick!, handn2}}
UOniable

uak a togçie Buten that dagea the scLen to dank- mad


whn icted'& light-mode whacicked agan.
n cbuttm id=mod' > chansg mode <buton
cbt
JS let madtn =dacumint qu Selacttn "# Mad
let a Mode =llqh

moda BimaddElenlLittna cikD,()


CunnMod =dank"

1973
let mod.8hn daum ent qeys clecon ( f moda4};
te bocdy dacumont uySct (n hocy"
modeBtn add Event-isenn ikl, 0’

bocy clasaliatadd "donk 1i


cdass Liat tumove
bcolv: t whik
ee cole bjack
CunMode= "ightl 3

3}

lases Dbjech
foto yiesn JS -A JS objeet isan entity hauing stak &behauiau
TS objecs hawe a spedcal pnopenhy CAtepui methods)
called pwtoype
we can set paoto hype usingPhoto metad
hawe Aame mehod ,objecs, puolatyte tllke
lled.

(orst Student =
fullvam ?anyam"
;1SamyamProny
manks : 94-4,
thiamk
Lobject
gtudnt monk
Kobct T d<aut ek otject hai - Protoype
Corat employee an
Rale lax (){
Cosole-loq. (tax hate is lo1:)

`alany 3Soo00 ColcTax() se

Protoye min empaye oyt


Kananhim -- Saatotmgaj dema ho9a
Symtex
dotpato
lasesin TS
dasa isatuogam ade tmplat en aating objecs
Theseobjech wil hawe bome stat (uaniables ) sme behautoua(mhia
init:
clas Mydas Gke a tempbt
bpint
My Mehod

Cuaingojtuing
mutod ujed wil
be
method
lanen-haue chlds mmthod,
Cuatingey
object sane hild
& 9*
[Link]
Paant eytends chilA las
3 fant Jay
mielae; lea_e= this
mi denived
5 Uas.
ojc lhuating
naunyd thiatnand
Conaolt-leg child to do
pant
passing hom muthods
ilnahuauttaand
a_e) Inhenitne
Jsin
Toljcta
(an [Link]
bbjectinitializes
cuad) ifnt innkud
"automatkals,
TUnstutnmethod
is
ha'. hoti mhi ahuna,setBnand(el Renhn
at koj meion
wd nand bane
amet bnand bhandnars this-
brand;
AetBnand(
hand
comma ihmethecd epnate tonéd No ’
()Stont
Toytalani Clasn
Sutn kaqsond paunt cla4
Ih Apen kyoend iA uhed fo call te coNtwct) of ita
D acaas he panntla paopetea and mhods
Aupen (ahgs) ald fanent coyt
Auph pannttMethodl (nys)
as fensn nane
Cgnutuctn
this opeuu = homo iens

eat ()
Cosole eq-(u eat;

lass Enginu Rxtods PeMOn


Conatucho (bnanh)
Oname

this bhanh = bnanch

let engcbË = nuo Enginen"chemia


Lphlechild coatutn muin gac^e

t 4 we want to aws catl) n then


We heuR to write
Auqeneatc0;
Prachice Qesis
Day- lo
Prichikj abune await > omäe Chaina >callback hell
Sync inIS
Synchnous means that code un ina pauticulan Jguna inatechond
given in he puogharn Each inatucion uaita fot the uoiuk
to complete ita eution.
Aaynchnonows Due t synchnonous pungAamning domnutnma imp
inshuctom qat blo Lked de to ome pauiow iihuchind which cauyed

rert insthactina inmmediately and doesnt block the ll


unctin hallo (14

Aetlimeout halls 2r0)


inbuilt funhion to cal! funtion and di ide, whunto cal.
paysed as an anpnent to cno
Calback a tallback is a union

unctiam bum Lat){


Console log (a+);
uncim calculath (aby ugallack )

Caleuatn 2dum}
mspased in anthen tn:
But hat pananhees.
oR
Calculaten2 (a6) = qUn uncion,

Calback hell
Cell back hell Nested call acky stacked below one anoth oing
a pyamid stuchue. (Pyhamid of Dovm)
ntiqData dataid, eetdata

AeTimaauk09i
ilgetota
Jata)
3
3,2670):
3

You might also like