




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Javascript Handwritten Notes, Java software
Typology: Study notes
1 / 162
This page cannot be seen from the preview
Don't miss anything!
WIND Jofe@sa yp ee |Z | 2/htmi> ai sites 5 3) me re helps in the Yvesuability of Code in- more than _ p__lOne HTML File. ee aoe f LS | 2 It _allows easy code ya Readability. 3. |t_15 time-efficient OS Web browsers Cache the external | __Js_ files, Which further reduces the Page loading time. as — | __6 lasstnat | rd ) Date ~~ | Qe fase er. lt enables both Web designers and_-Coders to Luo, . With him! and_js files parallely ind Separately, ie, "Without. facing any code Conflictions.— 5. The length of the Code Weduces as Only We nee to Specify the location of the js file... 1. The Stealee may download the Coders Code ugj the Url of the js file. 2..1F two js files are dependent on one nother then -.O failuve_in_one file may apfect the execittion of the other dependent file. == ae, 3. The Web browser needs to make an Odditinal —-http request to get the js code. 4. A tiny to_a_large change _in_ the js Code may _ _— Cause _Unexpected results in all its dependent files. .—_5. We_need to check each file that depends on the ee Commonly Created external javascript file. ____6.If it iS a fet lines of code, then better to _ _ __Implement the _iinternal_javagceipt Code. Mt. a chi C oe —_ Pines | -The_Jovia Script Comments ave meaningful way ] — to_deliver message. |t is used to add infor- _ -Mation. about the code, Warnings or Sugg- CStions . SO. that end User Con easily interpret _ the Code... | The JavaScript. Comment is. ignored by the _JovaScript engine i.e. embedded in the browser. There are mainly two advartages of JS comments. — [Gagan loro amsable | JovaScript tocol Nariable- thin the function Ch L ble_W _ re function. t—i5- _accessi : __ block. Only ——— "elma. —— oe —— | < script > . _ joey Punekion obe tl) ee var x = 40;:// local Variable cherie Soe wih = LL 4 sa a ____-Pmetion._A Viwiable i. declared outside the functin op declared_with lindow object is know a8 global _ _\Noviahle < Script > Nar data = 2005 // global Vaviable ] function allt , Script > /.___ JavaScript Data Types. aah __4 _____ JavaScript _ provides different data types to hald_ ____ different types of Values . There are two types — Of data types in SovinSenjpt sal Primitive? data: type oii) feeds Ft ey -—__2..Non = primitive datatype Mapas ‘ho i/[holding number vet Sh alee Mar b= "Rahal // holding string Sate igal, Sd {i | yin ' a Data Type | Description string Number Boolean lUnderfined | Aull Pepresents Sequence oF characterseg."hello” Pepresents Numeric Values e.g, 100 Pepresents boolean Value either False ortrue Pepresents Undefined Value Pepresents | null iG. no Value at all — | Data Type Description Object Arr ay represents instance through Which We Can access members Yepresents 9roup Of Similar Values Pepresents Regular expression _| _ |Reg Exp 1, JovaScript Operators are. symbols. that are used to. perform Operations On operands. | Licscsenibt uthmetic Opmatans | Arithmetic operators are Used to perform arithmetic. ‘operations on: the operands. Operator |Description Example | + Addition | 10 +20= #0 | tydl ey Fatal tateye Subtraction — 2.0:5-40.,= 40... | ® ~“|Muttiplication | 40*20 = at / Division 20/10 = te Modulus 20 % 10. = = 7 | ++ Increment |vara=:10;atti Now Qazi ee Decrement Var q@ =10 ;Q--) Nowas 9 & se: following Operators are known.as ‘JavaSexigt. Assignment operators Operator Description Exam ple | | = __|Assigh lorlo=20__ | a t= —_ |Add and assigh Wara=i0;Q+=20;NOWa=30 | a = Subtractand assigh |Vora=20;0-=10; Nowa=io _ | = Multiply and assign Nara=lojo"= 20; Now A200 ff ve Divide and assign Nara=!0; a/= 2;NowQ=5 —. L r= [Modulus and aS8igh Vara = 10; 2 %=2 Now a=0 > lava Script _Specia| Operators — __The following Operators are knoninas JovaSaspt Special operators Operator Description | @) sf onditional_ Operator returns Value based on _ a _|the Condition. |t_is like W- else. | ss Comma Operator allows ; multiple ¢ expressions | to be evoluated as Single Statement. delete Delete Operator deletes a property from | ee the object. _ a L. in {In Opetratore Checks if object ‘has the given | [ Lt _jProperty. | ae | | instanceof _ _|Checks if the object is an ‘instence of sien L i _ _|type = | new _ | Creates an instance ig ty - _____ | typeof _ _|Checks the type of Ob ject ) ep _| Noid. lit discards the expression’s return Value. fp yield “checks Whe is returned in Q. generator —— by the generator’s interator. a (ssa rece I~ Si j - el | The _ JavaScript if-else Statement iS Used t oy execute the code \dhether Condition is true ot ‘false. There are three forms of if Statement in ie: 4. If Statement = DINE - else statement —__ 3 pe else \f statement - —— It evaluates the Content only if expression is true. False ~ —_ Condition, _ | : — ] _ | Thue - if#—code: | “f - Prtter 4+ — i Lt. eens | _ | A lf : __, — _-——___ Javascript Switch i s The Janiascript Switch Statement iS Used to execut = ‘One_Code from multiple expressions _ = S Scjipt > = Var grade = ‘B's —_ - _ Var result; - _—_____ Switch (grade) § J Case ‘AN = eect! eel - _Pesult ="AGeadey; breaks _ ft @OGE Busine so Oe Ati we see tt | Pesuit-e "BGrode’; id __|| break : : Wee _|| Case C’; wien | result = "C Grade” _— _ break; ue a _RauMi ot ig eh ic = result =." _ document. Write (resuit); _ ao for (j= t5i< = 5; i+ +) Di sf. ! —_ — Re = on a brie") a a ee _ BR. . <1 scpipt > | Bdesascriet able loop The JonaScript. while loop. ‘iterates the. elements. for the. Infinite Number of times ._ \t_ Should be used i number _ Of itepation is not knoWn.. ——_Bivantage_of JanSargt_ function ___ diGede peusabiliy 27s syste vil ; ——2, Less_Coding ——__ UM at ale bef seme “_ JovoScvipt- _Function. Example _ oo _ |e < Script > _ aide afl eatet ihe nt ___. function_msg,() 10) eet | ilewt ("hello | thie ie nmesee neo eo — A) re ____ <1 sepipt > a _ Output Call function T ly We Can Call function by Passing arguments _Example _