0% found this document useful (0 votes)
7 views

JS Assignment 1

Javascript notes unit 1 sppu

Uploaded by

Madhura Peshave
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

JS Assignment 1

Javascript notes unit 1 sppu

Uploaded by

Madhura Peshave
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

PAGE NO.

DATE:

ASSTGNMENT- 1
Q'List the keu ditexence betwcenTava and
Tavascript
Java
Tavascript
DCbject Onthtd Ppqramaoin Chent -stde ceripting
q created by ame lanquage by Neteape
Suh micro originally krouun
systtom ater accupled liyescript
by oracle.

2) ork on Hhe clas TtoYe on prototype


bautd ohjecks andyou baved
Can not any prngcum
fn Java oithout
Lcreating cau
3) To u2nteTava program To wzite JauasCript
it reauiree an cpire pzDqram It requlres
Java development text editor
kil (IDK
4) The. The cade Can
biddena I s carmpild be atad byans percon
ioto Yhe wnzadahle writlen plain
type coding hy pe. text

s)Tava developed hy avasript lege securt


and you have tomake
kaping
Code"a4primany efloxt to
rootiv that Can be coding Arom the croac.
PAGE NO PAOC NO
DATE: DATE:

achiexed thanugh oite ccripting ete Q Scopeof Vadable In a Tavascript.


Vaxd ablu in Tasa script coDxk difterently from
Q2 Tmpoxtant featuaes of Tavaseript each olber lang uaga. Here,yodontbave to
Tnteractivity the type of
Tavascript
elernent On
enable dynomlc and oteractiye
Loebsftes ,respondinq to wAer dction
Lunltke otherprogramminglanguageyou
don'thave diflarentdata bypc for difleret
al time of ualues
hype keyuord
A Ctent-gide scripting VouCan Lear, cont cnd let coill
to decloart Vaclables and Tavacceipt
direckly web bzD0SCT, automatcally determine the type of tbis
aloing manipulabon
withot needing servea
of weh paga
Interaction
cantent Vanablel accordng thewalues pa4sed

s) Event Handling'
="elcome"
let tuo= to slmpli learO
Declaring
Tavascript atepond to Vaio
eventIike dick iapute and &Croll, cnhancing ConAolelog (one) WAcecaing vazlable ane
Wer cxpertehce. console.loq(tesl: lAcceuinq yaxtable two
conacle. log Cthrce)ilAceataing wariablethee
4 DoM Manlpulation
Tt inttract stth the Docwnent object Model Scope af vanable elere to the accetsibllity
(DOM) to modity and updat oeh page ofa partcudarvaiableoltbin the prgram.
conteotand structue
s) Cross platformi const meuraqe ="HII"; ZDeAining a vanable
aorki pérating ytena and h
&upported by all madern eh booDLCrs Aunction hoof
canuclelog meacage): MAcceaging
4)pen 8Ource Commuslty another Aunctibn
A large deueloper cammunity conbibute huo i Calingfunchon tuo
ibrdnie frameusotke and tool4 to enbance
Tavascript capabilihes Tavascoipt Vartable haediterent ariahle
scopei they
Galobal cope
DATE

Locadeope Prtoitlve
)ndeAned?
Repraed undaftned value
Block ope
avatep had only
had osly twokypaocope
gloeope
The block
andoead cope. Repxucnl hullvalut
qnynull
kayoovd A that ABocltan valueohlchcan be
Repitnt alboolean.
Functen cops!
Whh he. creien ecach Dafupdon )
Creater sOp h avarlpt.

Q Claunty the dalatypea In avasCrip.Give Reprcient.


Cxmplaof declavatonJneach.datalypes. oating palnt

|Number Primitlve data typ Brdght OSyrobol


Reprcsents. oique dentitier. edposmarily
Boalean tlndefine obfecl praperties
let d SymbolLCdescsiption D
wlqlsymbol
Nonpinnilvedata ype
|Chjet Non Pimiile data ReqExp
Objeck
Reprcs unt a calechion.of key value
polre.
pzDpc ttes,ohere.cach. keyaatring
and Cach value Can be any data type,
ocuding- ather oh<ecko.
PAGE NO PAGE NO
|DATE DATE

eg let ohË =(namei "Tahn"ageaoi Conat zeAult txtradvalue (obifrray'a)


Lcongale log. Czu)
Repzcent collechon of cdement.h
a
ohere eoch Qutput
elem cnt can be any data typca includinq
other anay and objecte
Arrayt an alo object1 In Tavascript To the above prngramth pmperty value
Lcgi let azr = 2 " three"7. Lof keya is ertracted fom tach obËect
lons an
The
array
mapmethod eued tn koded
thaauahal the elemeott of an day and
thxough
Repitsnte qular apraiontahlchJ a extract pznperty yalues of key e
pattrn ued to match character combinabor
let extactcd valut =acmap (Lunction (itsm)
TS prDqram to erttroct out the yauee Vou couddalo tgular Aundton
at the speclhied Arom spccifid amay intttad funchion.

proqram t cxbract value as atay Houo t creak ahject in Javascript


Aom an
A
Tavasript hjed i an cohty hawinq
Aunchon extact value Caa prnp) ctate and behavourpropertieu and mdhod)
lextoct value from praperhy Ar exampl i car pen.bike.chair glaukuybaard.
monitox d Tovaseript ohject - based
let extrat value =ananap (itarn >ltan lpnpl) anguage nylhing ohiect in Tavascript
chun extractedalue Tavasceipt Je teoplate baucd bote caus
boacd Here coe don't create la to qet the
Cont
objArray [ /ailki2}. fat4,bisl. obfect Butoe direct reate ohË cote
Crosting cbject by Javascript i
palsing a't ertract
nÊ cbiecteand prnperty. )Bycbject toral
of chjet dincctly
wing keyboazd).
GE NO PAGE NO.

DATE DATE

By Ing an ahject condtructue(uaing O/p 1ol Rapy al 5000O

keyuerd) obiet construtor


Tavatccipt ohject by abject ierolt Ksript
Auotion eop id, bame alazy)
value2prapcrty Ni value N
As o Lee pzoperty and vaue thi 1d: ld:
Stperatd colon ) thic nam sname
thia. salany = salany
<script eEnw emp(lo3. Iaih"3000o;
enp e d 102, name: Shyam Kumz".
Salany i40 0001 docuaent.oteCeid t
+ eucalany)
documentwnike Lempid) + tmpDame +
Jscript >
t conp talazy) Tain 2o000

Shyam Kumar 4D o00 Taxaseript ?


Tavaseript Acays the collechion
of ohjcct 6f elemept lor itcm) coed undera
s By izeaing- InstancL
single vadable
itays n Tavasctipk can tor the htem
:var objectname Enw ahject O.
Herc.ne keyword helonging data pe
lng the Tavaseipt Araå, Iiteral:
Var emp
emp Jd lo1:
ohjcet (), <html>
<body>
Lap salony =50,000_ Kscnipt language
type
E Tavascript
kxt Iavasecipt"
documeot write Cermp.ld ternp.name
enp.calanp. Var am1sHello MADHURA
dacument write (am1):
PAGE NO
PAGE NO
DATE
DATE

<scipt> Chody
Cbuttn
<Ihtol onclickachaeameesage O
click Me <buton
AR Dercribe the to indude Tavasuript
in HTML <lbody
(3) Extcnal Tavaccript
be Can include Tavasript directly ithin You c¡n place yeur Tovaccript code in a
HTML I to yourHIML
and ather
the
ondick, onchange.
event attibutc
ceperat file and
atrthut
ile uinq <snipt > tag
reatrallythir methad Ia uued when we
have t a Auncinn in the HTMI evert (4) Exent Handler Albibute i
atbibute The an cases or event) sn code alo be ncludedl
Tavacccipt Can

ohich oe haxe to adod Taxarcript cade drectty within the HTML cleomcntalng
evtot handler atbibute ke onclick
diredly
eq onmoYr event.ondick etc Lanloadetc
<body>
Ka haef = "#°anclick = alest ('Hi).> Qrg Compasion aptrator n Tavasccipt
olick Me <la> Compaiton aperat
value and retura
<lhody med
Roollan
to
cault
cormpare
tnu of falae) based
Ce) Tnternal Tavacripti the compankon
You pclude Joxageript code dir edly
oithin an HTML Ale a <script> tban
y<Aas than
2)= tater than equal to
<teript A<=ear than equal to
Auncton
alert choon
(Hellaearage
to
K Perfom hype conveTaion meaninq t
COnvere the value to a type
Lbefore
aaking the Campaaison
PAGE NO.
DATE:

doc not pertornm type


perforrn type conversion
reaqulrea both typend Voue to bethu
Console. log (5 === s ) /fale
conaole log (5a ='5)ltrut
a slople Javascrtpt Code
"=' and
6

aperatons
<html>
<head
<itle Javasript-compa riton optratu
<hite>
Shead
<body >
<ecript lanquage :Tavaseipt" tupe
text Iavascript ">
Var hum1E lo:
Var hum2 = 5
document.write ("numt' num
documnt.coite num2iDurp)
document write "Eahalto l==):"
num 1== num 2)/Aalse

document. wrik (" Shict eaual to (= s)."


hum t==lo'fale
<lscript Z
lbody>

You might also like