Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
11 views

JavaScript Assignment 1

Uploaded by

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

JavaScript Assignment 1

Uploaded by

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

VAIBHAV HARIAI

AssiGNMENT-1 0217002023
3M(A)
Ihasu Quustonsi

adiable declaatin ?
sasabes,but thuy
Fnb. n anSoikt, ae, lot,and cAnst as ubed to doclake
bahae dilliatly in tihms7 scote, kiding ,and mutalility .

sa i fundtin- scsbid , miaming, ith comlinsd to the aunctin in utich


itt declasod. s duclod atuide a functim,it tscomes gsbally scoksd.

Canditioral statamant, it acessible Misde that black uithin the somt

"Hsistingi

Censle. loy(0; llundalintd


Uae X=5;

-fGat aiabes kon te Auasiquad.

"Scabe;
[at) is tlsck- scafed., maning it is confined to Hha block (uiti )
ich it is dclasd. ThiL makus t meke
sdictableab it asids
Umuntnal acess Qulsd
Ans

lat y-10;

Ilsmasnsn: yis not dyflitd


Carsk. oly);
als hasid, but thuy ae nst
Vaviablu dclad uith t]a
" imbhal diad zene "bon the a
initaliid, ulikeak. This aiatis a
block untill the tnkiable is dicasid, duking ushick aassing it uit
te

lot a5;

"Mutabibta:
(3en
"Scopei
bleck in uhid it is daclaned and kannat Be aessud atside Nit.
"Haaing:
" Similas toe et|, Cmst is haistad but urimiialiyed, 8it has the
kame tmpeal diad zenl as at.
"Mutabilip:
.Const asiablu Kamst be sasiqnd Ence dcaed.
a Cemst aiable peint toan ohject s Housesee,
anay, the contnts thut
Censt z-10;
Z= 20; II TyfeErko : Assiqnmet to Constant yakiable.
Censt obi = {hame: Vaibhas> ;
Cbi. name =Bob'; lI Thi isalleused
Quo&2. hat ae
tighe-dsfunatins in Jaasibt ? Bueide
examles st at last tuse highe-Gdee tunetins and expläm thain.
USe cases. Dofine ushat athighs -Ahdt luntien is
lan be tliyed in Jou Scuiftt and kas st
fhb. Ahighck-Sde
aegkamming.
nctin in Iansoikt is afundtion that eithen:
(1) Takes Bne s msL unctisms as
(2) Ratubums aa functin as ie asult.asauant.

mamibulat Anctins and handle tasts uch as dáta Isonsfomátien


eent hondling, amd asyncheensus fsgiaming mte piciiny.
shat is a Higte- udse fundtien ?
ae 'frst-class itiyons," hih meams they
Kan be thuatid ike any sthie datalyße (eqi-
ahgument, htisnad by shen Auntions). Higkus- hdektud in Uakiablas, fasd as
capability to shorat an sthie functions, eithik by talingluntss use this
tem ab paamus e

The mat unten isa tit -in highik -sdet undtien in Tasa Scifst
AAay , alie a qisen gunatien to each elemot,
f hD
e ecum
aibnjt
e

data nitat nutating the kiqnal ashay.


thsethuc

Sytox :
askay,. mafCCatlbackfundtin);
Extmhle: Th
D eo

Censt numrs =[1,2,3,4];


Cem&t doubled =numbtks. maf
(rumbie imbe * 2): d y n

cONssle. lenrl doublad); I|Quthut : [2,4, 6,8]


The Alto ()) unctin isanshe
built-in
ioats set am atay, atplis a qsen fundim ighia - ohdie functim. 1
atukns a nio atsay Centauning Sny the elamin te each elamit , Ord
Canditien, tht mat the seihi
Symtox:
akay,. fttu Ccallbakfundien);

CEngt ruumbshs =
Cemat [1,2,3,4,5, 6;
esendumbns = mbersufitbumb )wumbik 2== 0);
Consale. Jolesontumbsse); I/ Qutbut : [234,6]
Qus 3.Dsaibe the
and it Kemastt the Doumnt Chject Medal(00M)
siqniliance in eb
the utue bf a seb lage Deelatmint. Bplain her the DOM akst
and ous Jaunsit intiat uitk it to
mamibulate HTML andcss?
The Decumnt ayit (DoM) isa agkamaung intirface that

uL. Tha DOM AM A atidae botuyen web jase Contnt (HTML od CsS

Stuudtuse the 30M:


Whin a ueb þage londs, he Bris Jarss the
HTML døtumtt and
suldinsliks.
<DOCTYPE
<htm
tonl>
2hlad>

<bedy
<þ> This is a sanle banagah.
z|>

foe this HTML deumt , the DOM


ka this; strudue usld Joek somtthng
Dgaumert
Each elemônt (eg,<tml>, attibutis
<Aiad><beyht,<#)
and taxt
tiko
ta
a nade in the DOM tL , and utlin ths
Siqniicance the DOM in heb Duselefmdnt
The DOM is cucial blcause it a leus ueb dueaks to acceu
madiiy the Contnt
Jaunsißt Can intiract uit the DOM toi Jendad.
2) Change Stylei- Dynamicaly adyust Css otisto mbdily tle
loek and lal.
3) Add RomoN Elamants i-Add nout HTML elemans kimave existi
enus to ciate inthactise Centent.
9Respond te lsu sntthatiens:- listnt to and Hadle esnnd

Haus JasaSoißt trtnads utte the DOM;


TaunScaipt uss the Hecmnt] oyict o intikat uith tu DOM. TRkm
maoditys and manage HTML and CSs dynanmialy.
(2) Selecting Elemat i- Jaunssibt Kan silect elomints inthe DoM
Using matteds ike getelmantbD getElmantey asimg
qsysalact and quthysalecto y. fr exanhle:
Censt hiading = decumint gotelimintb,1D(nain- kiading ")i6
II Select all
janagrusA elemnt
(2) Medilying Cortant :- Once an element is selectid , Tanseitt
can madily its contat.fa gamfe changing tke ixt af a uadi:
tontint ="Updatid d0M Conlit ";
Kam Ssat change Css styls

muthods ike altmdae bosstBdo.Elumint on also be

Const nausfakaguedh =doumÚnt.CauatElmsut ("s );


nausfahagah. tatontt = Thisis anu pakagaph.";

(5) Rasending to Esent:- Jasn sit san Jistin to eent ihe cich

alst ("Hsading clickad ");


);
Badtical Questiens:
Qussi. Guate a bimle HTML boge usith abuttn that, uhn
clickud chamges the txt a fabogah elmant. isit te HTML on
Jasascit code gequied te acemdlist this fask. Ensuke that ugut
Tasasoist is susbely linked te the HTML Ie?
nl
th
mbes
nb. HTML Codei
<4DOCTYPE tml
<ktml> ang =en">
<head
<meta chaset « UTF- 8>

<Me>Chamge Text fample <| tite>


<hiad>
Zbody>
<h1>come
<þ> id
to the Toat
Changh1)
=«tunxt This is the caiinal fabagafh taxt. 4p>
<buten Gnelick = «changaToxt ()" Change Texat
battm>
<--- nk to JaunScit Code ---

|body>
Jaun soikt Code (scilt .j)
II funtion teto change the tont sf he
fasagrafh
function changeTent () {
Cons fakagath =dBcumirt -gdtElimantbyt D(*tht );
pakagath.toxtantnt = The fasajpafh toxt tuu kaon
changed!";
,4,6,8,10] loalesenNumbens);
Otfut: || Censsle.
(bamplemay); qptbvenNumblhs esenNumbite= Canst
10]; 9,=[1,2,3,4,
8,
6,t, 5, amflefhay Censt
==0); numbee
2le (number= fte at. talsen
qotEsenlumbets
(ana) function
numbes ewen
Codei Scilt Jaun frb.
sage demenstatu
ih amd mothod ft the using Ancien
ment ahay. oiginal the om
humbors esen the ay
Asay naut ilknsa ahqunint
and an asAbes
fasay an
Taks that homtitn Jaunseikt a hit A

You might also like