In this video You will learn.
1.If
2. If else
3. If else Ladder
4. Switch
5.For Loop
6. While Loop
7.Do While Loop
8. For-in Loop
JavaScript statements are the commands to tell the browser to what action to perform. Statements are separated by semicolon (;).
JavaScript statement constitutes the JavaScript code which is translated by the browser line by line.
Example of JavaScript statement:
document.getElementById("demo").innerHTML = "Welcome";
Following table shows the various JavaScript Statements −
Sr.No. Statement Description
1. switch case A block of statements in which execution of code depends upon different cases. The interpreter checks each case against the value of the expression until a match is found. If nothing matches, a default condition will be used.
2. If else The if statement is the fundamental control statement that allows JavaScript to make decisions and execute statements conditionally.
3. While The purpose of a while loop is to execute a statement or code block repeatedly as long as expression is true. Once expression becomes false, the loop will be exited.
4. do while Block of statements that are executed at least once and continues to be executed while condition is true.
5. for Same as while but initialization, condition and increment/decrement is done in the same line.
6. for in This loop is used to loop through an object's properties.
7. continue The continue statement tells the interpreter to immediately start the next iteration of the loop and skip remaining code block.
8. break The break statement is used to exit a loop early, breaking out of the enclosing curly braces.
9. function A function is a group of reusable code which can be called anywhere in your programme. The keyword function is used to declare a function.
10. return Return statement is used to return a value from a function.
11. var Used to declare a variable.
12. try A block of statements on which error handling is implemented.
13. catch A block of statements that are executed when an error occur.
14. throw Used to throw an error.
JavaScript supports different kinds of loops:
for - loops through a block of code a number of times
for/in - loops through the properties of an object
while - loops through a block of code while a specified condition is true
do/while - also loops through a block of code while a specified condition is true