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

A Closer Look at Functions

1. This document discusses various JavaScript functions including higher-order functions. It provides examples of functions like book(), addTax(), and runOnce() to demonstrate concepts. 2. Higher-order functions like book.call(), book.apply(), and book.bind() are used to call other functions and pass arguments in different ways. This allows manipulating how a function is called. 3. Functions can be assigned to variables and passed as arguments to other functions, demonstrating how JavaScript supports first-class functions.

Uploaded by

Water Vapour
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)
50 views8 pages

A Closer Look at Functions

1. This document discusses various JavaScript functions including higher-order functions. It provides examples of functions like book(), addTax(), and runOnce() to demonstrate concepts. 2. Higher-order functions like book.call(), book.apply(), and book.bind() are used to call other functions and pass arguments in different ways. This allows manipulating how a function is called. 3. Functions can be assigned to variables and passed as arguments to other functions, demonstrating how JavaScript supports first-class functions.

Uploaded by

Water Vapour
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

Date /-1- Saath

Funchons-
Deaul aamekas
Se a dikaut yalu ethpakmak_in
twehm h n we had do ne h shor Ctha
Const Ccheale Laoking fuactian
fishNaro,
num len gAs
prt)L
humamenaes 2 nmkameseK 1|L Z S S Aay
rom ecLuse changa mi cond in _u ralus
parzmeA oihalre
Conct crealeßuoting funchon

humlanengeas=
sice =199
11ESG_eay
Valu ekerena

a n eozect skti iode a


mchm a parmeA
nd dokins that aiaot obctauhhda te fuchon
then
e chameh Yalue muialele inida He
uchroh ll no e clameed ousida but it
wcham omeHairq n he obput hent il
()
bchanged outide t be
retrn ce
gcr uk S ckomge o h heap
chyeAY _ukid aoo
Page No.
Date-
Saatht)

Cons tight: LH234


Cons

ame on SchaMe d{mann


panpr 24439419 284

Const cherkn tunchon (ushtNom_, 0engr)i


ftlghtAluna :'LH999;
pemm4Pr,namg MT.tpomengeA nAm.

CheckIn(uaht jonaa
w l L give ftgh LH234 Jonas.name E M.Jana
Schmdhmann

Arsclass fumchons JS krrak hnochiansas ax


daa cihzensie
clam imy a iomply alues cmd

Asgr Lons

Cnnsslelaaaoba

iGher-Order fune hony A wch ha ecoleo maha_


nchn as an arunoeat ha re m a nen hm

Callhack fmwehonl
B n rektminq anolhen unchnpos
tuwchon ( u n t ( {
er tsUner20/
rekamn fuehim A)
CoUnetT

Page No.
Saathi,
Date

Callhock uanchaM-

funchauAccephag
HaherOder

mentmat,
asaMqAen
wnchom
CM
accepts
nachn uschan.
callback
hem a fumcban lct)
ConttoneLdnd
= fmaks
" nouxr(eri)
hunn sir.replace BAkna
sh) i_
i a o d fuuncthion
fchnte ont ppe
n t Ld chhers je sts.splat(
UpperCaae ), hhos J j i n ) _
ean Ast to

fn)L
Cons mscoer funmhon ch,
(s)}/fucha h
Conssle ls(Tnstmed sing in
fnchen:
ansAnrmJaxaSoaig is be oreMod)
javeiSodphubes
hnam (JavnSag in ke upperchr-ibd)
JANASCRIPT lex

fmchoms rehnin tumehmsi


Higher order tumehn
we Cam alaoxkn nnchon
CmS cet hcion {greshng)
ehu uwchoq Lname slwill

tomsr eclealHty E grec Hey) tShe innn

Page No.
Date /-
Saath

lty Jaras s2 kred in nae A


Greeksucbm

w ib cupurmo Aey i
inuoked

de comalho upe

fushon-
* Cm ne doubl Proniaeda_on ha ek
nchon8
e md it ill invoke bs

9neoHi2 Jonal)
Jmas
Dind mekhodi
Ihe Call ap
h e callUmeBhad calls afumcb m a
CalO angunnenk _pmded thdiidually.
aven hisvmus md
Ihe calUD alos fa a smchian mehd beltngin
a difteren dotec
o be_aaaned_and called e
obe

apgyi) melhod cals awcSan alh a vep


app -he
poded o n amay
h i c x a u s ,md arumen
(ase_cal
Noia e dun ise apply) MLuzh A Cm Smply
Lamd ccad cpeuh aaLmn jc elhas avay._

imdt-The bind) mehod cealeo a ni dumenion_ha

vaueuih a r e n uencaD umens recedlng


Ohonthe_ ne fumdhon is called.
any roAded

PageNo.
Date I-
Saathi

Comst utthanca : i
ailine'Lufthomsa
iataCode 'LH,-

bantings
baak(ishtBlum, rame 1 on_
beok
tonaleslag(*$Sname
booked a sea
iE Pighttlum1')-
$ithis.airAinel ftigkt $1 hic.iahok
he
maipulgkd

u f h o n s a ,h o o k ( 2 3 9 S o n a s 2
uAhamsa_ughE |H239
seal_on
Jonag booked a

nalheaaidine to uwe Hu
Nod iwe LDm
do ce rreonk Hee
eðnk H
LMeHaod bonk hen ikponHe
wokhod cgain L0 ue Cm we call), apply,bind1

Const book= ufthansa.lbnok / declaang. the bazk vefho


gloally

Nouse De_ amuaE call baou to gv ame nOMulE

08 aboVe
bonk239, JonasO

Cons eurdainA 2
aune
Kne umuoings
iataCodo :'Ew'
bookin U

we bODk in eumojngs u l L w e calAU, -


CoL is - uoe
frnch on
Ebook.call avboing, 23, Sardh)
Console. h (eunpLoing)
Page No.
Saatht
Date -/

rah_ 20oked_a seat on EurooigA igh N23

Anpy
Const hghtData= L583,heorJeJ
pook. apy osings_ ishtDaa2
Console.lag leumiainga)
banked a Right EWS83.
ateyge onumLings

nskad t apy
l e canupe calll & sptad spexakx

bookcall leumoins,tightDals,)

Cons broktd book.ind (eutmuoings)-


booké (23, Sleven'
fuoangs ugn 23
Skxen ldked _a Seat _n

sequencia anauments iie


RCan also_Se A _a
ua ind
s bookEN23 bookbnd euDWng, 23)-
LonkEN23Jona2
_kunooing gh EK23.
Jongsbooked
Jona a seat on

(rak, value) 2 value value ate


Const add Tax
n t ) 0-23)
Constaddi/ATE add Taxbind
laddVATlloo) Lhen here iu no kmebm
Console ks
1a3 hichHir layurd
cam he reperud
addyATevalue = Yalue t vraluue o-23
hin i parkz/ applicasjm. Page No.
Date -
Saath

mmediakly 2oded mcbom éprem

e
mmedisky insokea func hon m d
LIFE. Ne
AChm_again then we wme LEP it_in
vauial md
i a
tbynot asignin
parenH s.
Noma umeb
fmchian) i
Lonst runOnce = rum again
Cnaslo.wg T k willn e r e s

uDOnce l)

fumcbon t) L
will noActA m eai
Lonssleikrg Llh

O9 Consle. Lugha lnert um agaso 2)CL

We dant ue IE snyma beau

Cosuurs
A closure i the Cslosed-ove_Vaiialele

wnchan 030 creakd, euen akler Hhat execuhm trAt

Closn e tmehon KOMto a l yau'nbleS


Lef it_parents chon/ vasisbla ha exlated at a
AAhors bih plaAeVen a Heparent udin
hao rewnid he mmchn .cees a kerena to is
t a SCusp,Ohrh pDenMeo -he ScSpe_chain HbaghoutE

PageNo.
Saath
Date /

Cont SecuaLBonking ucham)


le
ehun wcian )
C6nadle.kg }pam engen Cmunk Fpaanenges

LonA padkor Secun Bamkirs


bon zer) 1pamenpes8
hnker 2 2 paenyil
onker _ / 3 pamens
pamenalnor _inct21
e
al
hwhim alLthauh i girea kr nh
2Ch_Call o bke _paeryealka
Sea Bu kin i lhs Acntn
nuhon
dus e_closu

Page No.

You might also like