javacscript: -------------------- javascript is a scrpting program for useful to develop front end applications, But recently they were developed node.js so from node.js application javscript useful as backend application also. javacsript is implemented in many other application angular, typescript, reactjs, nodejs, jquery MOngoDB javascriptscript is one of concept is developed by brendon eiche 1995. live script. java it is Object Oriented Programm and it supports OOPS, class, object, polymorphism, javascrit is script based program language or Object based language . 2015 javascript also introduced some of the features like class object const let array arrowfunction or lamda expression var javascript is implements some features in the year 2015 . ECMA 2015 (European Computer Manufacturer Association) ECMA 2015 standard or ES6 standards: Any javascript is a light weight program, javascript: --javscript support operators --javscripts data typescript --javascript supports array , Object --javascript is also control statement --string --event handling Mechanism ---validate form Data types: ------------------------ number boolean null string javascript also embedded in html synatx: OR Basic Example program to inclue javascript code in Body section HTML: -------------------------------------------------------------- Example program to include Javscript code in Head Section: ------------------------------------------------------------------- Operators: ----------------------------- Operator is a symbol performs action between the operands. 1. Arithmetic + 5+2=7 - * / % 2. Assignement Operator: = var a=10; += -+ *= /= %= 4 3. String Operators: ---------------------- + var str1="sravan"; var str2="reddy"; var str3=str1+str2; str3="sravanreddy" In this example + is an concatenation 4. comparission Operators:OR Relational Operators ---------------------------------- < > <= >= != == 5. Logical Operator: ------------------ && || ! Control Statements in Javscript: -------------------------------- control statements in java is useful for controlling the flow of execution conditional Iterative Or Loop statement conditional statatements: if if-else elseif nestedif switch loop statement: for while do-while function in javascript: ---------------------------- Definition: a function is a statements or a group of statement executed by a single unit. In javascript function definition defined in following ways syntax: function function name() { statements; } Note: function definition in javascript we write either in head section or in body section. but function definition execution only possible through function calling function call: function call in javascript invokes function definition . syntax: functionname(); or using event trigger mechanism to invoke the function definition. Example program on function using event trigger mechanism: ----------------------------------------------------------
Note: in the above example onclick is an event , similerly javscript support many event handling mechanisms they are --> onclick -->ondblclick -->onmouseover -->onmouseout ->onload ..... etc Example program on function calling: ---------------------------------------------------------- Example program on function with parameters: --------------------------------------------------
example2: ---------------- Javascript display possibilities: -------------------------------------------- in javascript to display content we follows the gien ways. 1) Writing into an HTML using innerHTML 2) Writing into an HTMl using document object 3) using window.alert() 4) using console.log() 1. Using InnerHTML: ------------------------

Using innerHTMl

getElement ById method we are using

2)Using document.write() --------------------------------------------- 3)using window.alert() ------------------------------------ 4)using console.log() -------------------------------------------------- Note: in javscript using console object we print the javascript code on console scree. in the following example using log method to print text on console screen.... Ways to embedded javscript code in HTML: ------------------------------------------------------------ To embedded script code in html we follows the given ways. 1. body 2. head 3. using external file 3. Using External file: ------------------------------------------- In javascript using external file to include the code, in the following examples are included javascript code in external file Test.js --------------------------- extern.js --------------------------------------- function display() { window.alert("external js file"); } Note: In external file inclusion in javascript both file must be included in the same location. ECMA2015 OR ES6 standard javascript includes these below features. let & var keyword: ------------------------------------------- Ex2: --------------- Uncaught ReferenceError: i is not defined at display (Test.html:12) at Test.html: Examle program on var keyword: --------------------------------- Note: The scope of the var keyword exist outside of the method also. const keyword: ----------------------------------------- ex2: --------------- Uncaught SyntaxError: Missing initializer in const declaration Arrow function : ------------------------------------------- Arrow function in javascrit follows with a different syntax: equal sign before of the parenthesis and after paraenthesis arrow sign Arros function concept executed by fast by the engine. this keyword: ---------------------------------------- here this is a keyword, in javascrit this keyword referes to the global object by default i.e it referes window object object contais(properties and methods) output: window window object Declare this keyword in normal function: --------------------------------------------- return: global object i.e window Example program on this keyword declared in Object: ------------------------------------------------------- whenever we declare this keyword inside of any object in that case this keyword return only that object related data only. javascript objects: ------------------------------------------------- A javascript object is an entity has state and it's behaviour (properties and methods) --> it is not a class based language . In java how we create Object: first we create class after that we create object In javascript class doesn't exist we create directly Object Note: we don't create any class, but we will create object directly. How many ways we create Object in javascript: -------------------------------------------- Here in javascript object creattion is mainly follows in 3 ways. 1) By using Object literals 2) By using instance of an Object 3) By using Object constructor 1. By using Object Literals: ----------------------------------- In javascript object literal follows the given syntx: Object ={Property1: value1,property2:value2................} 2) By Using Object Instance: ----------------------------------------- syntax: var objectname=new Object(); 3) By using Object constructor: ---------------------------------------------- Builtin methof of an Object: ----------------------------------- 1. assign() 2.is() 3. freeze() 4.isfrozen() Example program on Object.assign() method: --------------------------------------------------- Example program on is() emthod in javascript: ---------------------------------------------------------- Object.is() method used to determine whether two values are same values or not.

Object.is() method in javascript

Example program on freeze(); -------------------------------------------- when we apply freeze( ) method for any perticular object then taht object values doesn't modify or updated. Example program on isfrozen(); ----------------------------------- Using isfrozen() method we check the objects which are in freeze state or not javascrit Date: ------------------------------------------ javascript date object exist with multiple builtin methods. using those methods we find the date, year ,month etc.... Date object built-in methods: ----------------------------- getDay() getFullYear() getHours() getMilliSeconds() getMinutes() Array Object in javscript: --------------------------------------------------- in javascript Array is an Object represetns collection of similer type of elements. Array Object in javascript created mainly in 3 ways: ------------------------------------------------ Those are 1. By array literal 2. By crating an instance of an array 3. by using array constructor 1. By Array Literals : --------------------------------------- var arrayobject=[valu1,value2,...........] 2. By creating an instance of an array: ---------------------------------------------- 3.using Array constructor ---------------------------- Array Methods in javacsript: ------------------------------------- The following builtin methods supported by javascript. 1. concat() 2. filter() 3. reverse() 4. sort() 1. 2. 3. revers() 4. Browser related Objects: ---------------------------------- 1. window 2. history 3. screen 1. window: ---------------------- alert() confirm() prompt() open() open(); ---------------- 2. History Object: ------------------------------ forward() go() FormValidation: ------------------------------
Enter the USerName:
Enter the PassWord: