This document covers JavaScript control flow including data types, operators, decision making statements, and loops. It discusses JavaScript data types like string, boolean, and number. It also discusses operators like arithmetic, comparison, logical, and assignment. For decision making, it covers if, if/else, if/else if, and switch statements. Finally, it discusses loops like for, while, and do/while loops for iterating code. The document provides examples and explanations of each JavaScript control flow concept.
This document covers JavaScript control flow including data types, operators, decision making statements, and loops. It discusses JavaScript data types like string, boolean, and number. It also discusses operators like arithmetic, comparison, logical, and assignment. For decision making, it covers if, if/else, if/else if, and switch statements. Finally, it discusses loops like for, while, and do/while loops for iterating code. The document provides examples and explanations of each JavaScript control flow concept.
JavaScript Data types are used to identify the type of data that is stored inside a variable during the script execution. So JavaScript data types are basically for identification purposes to know what is being stored in the variable, when it's stored, not before that. 1. String – E.g var str= “Web Program”; 2. Boolean- E.g var isOn= true; 3. Number – var age=25;
7.2 JavaScript Operators
Operators are used to performing operations on the operands. Operators are useful to modify or change data by manipulating the respective variables. For example, there are two variables a and b and we want to add the values of both of these variables, to do so we can use arithmetic operator + to perform addition of these two variables. Types of operators: 1. Arithmetic eg +, -, *, / ,%, ++,-- 2. Comparison eg ==, !=, >, <, >= 3. Logical eg && , || , ! 4. Assignment i.e = 7.3 JavaScript Decision Making Statements 7.3.1. If statement It evaluates the content only if expression is true.
7.3.2. If..else statement
It evaluates the content whether condition is true or false.
It evaluates the content only if expression is true from several expressions.
7.3.4. Switch statement
The switch statement allows to make a decision from the number of choices. If a match is found to a case label, the program executes the associated statement. If no match is found with any of the case statements, only the statements following the default are executed.
They are used to iterate the piece of code using for, while, or do..while loops. It makes the code compact. It is mostly used in array. 7.4.1. For loop
Javascript Coding Book For Beginners Web Development Crash Course Head First Javascript Programming Book For Modern Software Engineering Javascript The Definitive Guide For Coding Interview
(Ebook) Java 2: A Beginner's Guide by Herbert Schildt ISBN 9780072225884, 9780072230413, 0072225882, 007223041X - The ebook in PDF format is ready for download
Javascript Coding Book For Beginners Web Development Crash Course Head First Javascript Programming Book For Modern Software Engineering Javascript The Definitive Guide For Coding Interview
(Ebook) Java 2: A Beginner's Guide by Herbert Schildt ISBN 9780072225884, 9780072230413, 0072225882, 007223041X - The ebook in PDF format is ready for download