No
Hssiqnment :o1 Pege No.
Date
Explainthe featuTeI oE Tavascrlp+.
Javoscsiptispopular
pepu lar Qigh
Qigh weight open SoU1 (e
CUe n} side Seripting longuagc. IHhos owing
foli
Lfeasuresi
io the Tavascxipteverything
Objeo-bosed-as
obje that'sCuhy ja uascript ison obect bared
progra m ming Qanguage (Seaiptirg language).
ImkopretegBo sed:- cript uiedinknpreer
os javas
of conmpilationthat's why jo is
ja vascaipt.
intrpretr 6osedscTiptinqonguoge
ake o the
Tobulh-fumctioni-jusk Rangucges
ioinfunchon.
4) stattmnt-java
if-else- scripE Uco 6os ifelse
SAattment ike o ther Ranquages
Cootro statment-likeothes lamguagesjavac
a lcohas Co to eatnent.
G) |Cose se msítiuei- cTp
jauoc iscaseceneifive anquge.
CLiert sideJechm olagyi- 0s j uaccoiptisexecwtrd
a
Qi de so itoeduces Qoad of appeicah'o
ic ba ted
labich Crves i de.
8) Looping
3ip chate nt
,whileloop othesang9
|Lightweightedi-javoscaip
cuby i} ig ht weigbted.
to) Euent Handlmqi-
Qike mousecvene)
tor
jvasCoip Co d
Key
user inpui
)vokdating Jovaccaíptis
va lido
tion it Ualid
ate e teIed Uscd to prf
data by the
User
2) Scaiping
Danguagei-
jevaccaipt
exe cutìnq pToqram that'swhy if isSciphn
Donguage
e-g <script) <\scoipt>
Que a]Explaîn)
Dame.
: Method )PopeTty ) Evern te ) objer
i) Me thod: -
A e thod is Cet oE state ments (actionc)
obje when it Teceiues mest a
)Poopestyi
A property data VaUae ass uatt o d cwith
objec
Page No.
Date
asc Eve tsi
peuf ic
an QcionpofoTmed by a on
i
ptsfo med by the bTOWces) that
T
that' by javascaip t that the
iv)obeci
O bj ec to of
otoTe collecfions data &
Co mplex entities.
Quc3 What are opesatogs in jqvac
cript Explaoany
Opeatoos ?nJavaccsip
t:
) AsithmeticopeTa tore
Copasism o 0
3) Cogica Operator
4 Bitwiceoperatorc
5) Acsignmot Opratoss
Con di tio a! OpesatoTS
Asitbmet c Oper atoss:
Asitb me tic opesaor ase Used to
6etUeeO variables& (og Ualues.
A doiion
Opesat or
a) Cubtocti
on oper or
3) :Mwtiplica
tion Ope ato
4) Opesat or
ModwUs (seTn aj nJes of division).
opesator
) ++' Operator
ondi4ional opTto6s:
Caled
Opesaos,T5is fine
40e or alce f V aue 4theo
ote
eseU of the evaluah'on, depending pon
th
:A chor uay to euite an
-else
Que 4J Explunlwi
tch ca ge ctak
Stak meo
in
to e jauorcaipt
the stak entsfoo xecuteOne of
m m m
bloc
uce the saitch
otatemeot +o ce le ofCFatntn
One
blo çkcof execute d.
Co de to be Of Tnan
JBe iotpreeTchecks ach
Vawe of the expoessiooOnti|
e
o9ait the
If nohing atchesy de fauO a
be uccd.
Que s]ExplainLoop ekakmeot in avasesipt?
Soetines to do ue
th ingfixed
PasticWarcondiio
me.
Se que ce of Catt mete is epeated
Co di tion,
iF is aid to be in q loop
Jhe Dooping th a oepeats
PageNo
Date
block ot Coteme te
a
Cpeofied Con diFoo become
Javoccipt uppots following kindsofoope
For oop
i)
ii) ubileQoop
iv) dol bile o op
6JHo cu cef amd delete the prope oty iojavascxi
Que
SetFin
to
Psopeoties :
Brocket Nota ti onIJis
nte <Sesipt
Car
Colo s:ed"
bsad
3:
do cu net wTite
ln(car['ColoJ+"<
bo >
Carr.bT nd):
4deteteret </CTípt
Dele og PropeT ti es:
-
Fos dele bng proPr ty
prop Ly lek key
deek wod
key w0Td ic Used
<rcript
Colon:ed":
badi
documnt. itln(cor Colon 'J"<hy.
+
Carn.brand):
delete Car "colorJ;
delete
dacesnentaìtelnSbA{ko Delehng ProprIti
<b>")
Joumcot.CusiteJn( Colo7:
Curit
documen, |n( son! + Cas.brad;
KIscipt>
nasuti
Aksko Oeletimg Properties:
Color: undefined
Brand:Gndefined
Que 7]Explain
Propeshy qetkss metod
in javascript
Gje tk Metho d:
A
9e th metho isuce d to toe 4heValwe
es Of
propesEy t 'e deincd ucingthe 'getkeywor
1
follo wed by the propeo y
eg'
<scsipt
Page No
Dste
Va Cat
Colos
brand*
gel co mpony)
baodi
4hic.
decument. ln (cat.Company
cUite
</sc ip t
Ities:
SetkT tMetbodi
method ic to cet the value of
+he 'cet!
keywoTd
ollo
wed b the propesy
<seoptz
Vas Car
Co l o o iled
";
brondi
Compa ny (vawe
+his.
brand
Car co mpany
ldocumnt.
Curiteln (car.
brand);
</scoipj
Olp:
Page No.
Dato
sipt
+he belp of sita
ble exa mplt. cuit
Dot Syntaxi
PTpe & ne thode assoJaed
Objech Con ocesscdbyucingth objonor
be
Cuith a dot Syntax (peaiod)e.g:uc(T.
a fno
Tlname uses. fwlwa n
You se dot syntox to descsibe+o Tavo
SC1ip
ho w to
a app4ico hon.
Studet
Vas
fiTtnome: A mit":
"Gupta
id |2;
fwimameifun
ction() retuID this.
fitsNa
Narn Y
+ + +hislas Dame
Stude class " Fifth" add mw pr o perty
do wnnent (student Id "+studeot.id
ariteln =
document osit("<br/);
Fage Fie
Date
lassPifth
Soden
Lict &
explainLogica operatovc in Tavacc*lpt.
0
Logcolopesatorc
LoqicaJ opeTatoo ae Oce d
logi betweeo Vaiobles Values.
OPeoor Decc «iption Example
If tht bothoperands
AND Opkrator) ZetO the Co nd beco oec
gical If
JI(Lo Qny of the two opcrande ore istrue
(A|e)
oR Opcato) then Condn beco me t ud
lLogi
a|NoT to eeTsesthe 0oqical tate|(AB)
OpeTap)
+hen LogicalNoT opraU o will
make folse
Cuith"
Statoentclause inTavascvipt
ucingcwtable
exa ple.
with SI a me} -
in Javascoiptis Ured to Clmpl
to the propcroties of a
porticwar b ec. o
Dats
yotox:
L
block whr
Code
aesed diect
o
bjrpropestie
KsCipt
Car
Colo
brand:
fundiomprinCarTofo()
with Cco)
docu to}.wrie Colo ,co
lo )
Cwte (1Bromd:"bsad):
psintCar Tm fo (0;
<lscripty
Olp Co lo Red
Braod onasti,
QucllJ ith yntax of Qnd explain
pro mp method
in Javascrípt
cwith the hep of Swtabk xampl
The promp+ ()'
oncthod in Iavaseipt is
6 inpo tha disply dialog6ox to
aslt- th
to eo ttr
SeTTO mp hog +beo to
Page No.
Date
Oy ax Var UreT Iopu poo mptPd np
hecCage '," De awt Vawe ")2
nam=pTO pt pleace
( entr you narn
Aoiba"):
do (ucetConce|ledhe
Cumemt.uite
pro np
");
O/p:- HelloAriba
checke cuhethe
Javaseoiptfo thbat
12] wite a
Dot.
Que
Ssed staing ic paJind
o me
po
KScoípt
me (Sts)
is
uction Pa indro
ConcE
Cons
madam
PageNo
Dats
ComcE
Consl
Curit
/|
La...
PaJi odome(Cla)):
is
document.
o cumcok wri (isPaUindoo me (st)):
/te
< /scoipt}
tia te
Bifferen 6et ween promp 0 g aleo()
Qu 3
me thods.
PoompO alest(0
) a
iop
bo x.
Jo
n
display
a
essoge
ofificohon
by Jhe Uses intr by acs
+he 4he ok button to
)
tping ing
inpu field. c ackoowDedqe the message
3) If the ue icke Jhe aestU ethod doer
4 proUidrs iopw.
4) Ured when yo u need to to play
dis noHfic
Lg ather înp from the ation,essaqes
) Or
Use s,Such as t6eis
to a to tbe ueo.
a Tavascript
tbat oisplays
fisst
ao e ven
PageNo
Date
unberson he docu met Uidow.
Kscoipt
Const body 5 docu meot bodyi
ContevenNumberElementdocumcnt C eak
Elm(ot(p);
+ex Con teoti)
body:appendChild(even umber Elemcnt)
scsipt
4 lo |2 |4 20
24 262 8 3o
Quc s]
uTit a ProgTam to print Of e ven no's
Getces 1 to Using for loop.
e
fo (eet i=2j
i< = (o o)it=
2)