580 likes | 6.93k Views
( ** Full Stack Web Development Training: https://www.edureka.co/masters-program/full-stack-developer-training ** ) <br>This Edureka tutorial on JavaScript explains all the fundamentals of JavaScript with examples. It also explains various features and applications of JavaScript. Following are the topics included in this tutorial: <br><br>1. What Is JavaScript? <br>2. Why Use JavaScript <br>3. JavaScript Fundamentals <br>- Data Types <br>- Variables <br>- Constants <br>- Loops <br>- Conditional Statements <br>- Functions
E N D
Agenda What is JavaScript? JavaScript Fundamentals Why learn JavaScript?
What is JavaScript? JavaScript is a scripting language that allows you to implement complex things on web pages. Interpreted language Runs on the client’s computer Web pages more interactive Interpreter
What Can JavaScript do? Smart watches Web application Games Website
JavaScript Framework ReactJS jQuery AngularJS Meteor
The Big Picture – HTML, CSS & JavaScript JavaScript HTML CSS
Benefits Of JavaScript Easy-peezy Easy to learn Speed
Benefits of JavaScript Makes web pages more interactive Provides rich framework
Benefits Of JavaScript No compilation needed Platform Independent
JavaScript Fundamentals
Variables Variable is a name given to a memory location which acts as a container for storing data. Memory location Syntax: 1 2 let age; age = 22; Variable name
Constants Constants are fixed values that do not change during execution time. Syntax: 1 2 const mybirthday; mybirthday = ‘03.08.1996’ ; Examples of constants
Primitive Data Types Numbers Strings Boolean TRUE FALSE Null Undefined
Reference Data Types - Objects An object is a standalone entity, with properties and type. Name Syntax: Age 1 let object1 = { }; Eye-colour
Reference Data Types - Arrays An array is a data structure that contains a list of elements. These elements are all of the same data type, such as an integer or string. 0 1 2 3 4 Syntax: 1 2 let arr[ ]; let arr = new Array( ) ;
Reference Data Types - Functions A function is a block of organized, reusable code that is used to perform a single, related action. name of the function enter parameters here Functions Syntax: 1 2 3 function greetings( ) { alert(‘ Hello everyone! ‘); } Predefined Functions User Defined Functions
Conditional Statements Conditional statement is a set of rules performed if a certain condition is met. It is like an ‘If-Then’ statement. (IF a condition is met, THEN an action is performed) If Statement Start False Syntax: Exit Condition 1 2 3 if(condition) { statement; } True If code End
Conditional Statements Conditional statement is a set of rules performed if a certain condition is met. It is like an ‘If-Then’ statement. (IF a condition is met, THEN an action is performed) Else If Statement Start Syntax: False Else if code Condition 1 2 3 4 5 6 if(condition) { statement a; } else (condition) { statement b; } True If code End
Loops Loops are used to repeat a specific block until some end condition is met. Start Loops Conditional Code True Condition while for do while False End loop
While Loop While the condition is true, the code within the loop is executed. While loop Start Syntax: False Condition 1 2 3 while(condition) { loop code; } True Conditional Code End
Do While Loop This loop will first execute the code, then check the condition and while the condition holds true, execute repeatedly. Do while loop Start Syntax: Conditional Code 1 2 3 4 do { loop code; } while(condition); True Condition False End
For Loop Repeatedly executes the loop code while a given condition is TRUE. It tests the condition before executing the loop body. Start For loop If no more items Item from sequence Syntax: Next item from sequence 1 2 3 for(begin; condition; step) { loop code; } Execute Statement (s) End
Switch Case Start The switch statement is used to perform different actions based on different conditions. Switch expression Code block 1 break; Syntax: Case 1 1 2 3 4 5 6 7 8 9 10 switch(expression) { case 1 : code block 1 break; case 2 : code block 2 break; default : code block 3 } False Code block 2 break; Case 2 False Default Default statement End