JavaScript Loops
Loops are among the most basic and powerful of programming
concepts.
A loop statement allows us to execute a statement or group of statements
multiple times.
JavaScript For Loop
The for loop has the following syntax:
for (statement 1; statement 2; statement 3) {
// code block to be executed
}
Statement 1(initialization)- is executed (one time) before the execution of
the code block.
Statement 2(condition) defines the condition for executing the code block.
Statement 3(updation) is executed (every time) after the code block has
been executed.
Example
for (i = 0; i < 5; i++) {
text += "The number is " + i;
}
JavaScript
String toLowerCase() Method
The toLowerCase() method converts a string to
lowercase letters.
Example
Convert the string to lowercase letters:
var str = "Hello World!";
var res = [Link]();
Output: hello world!
Modulo Operator (%) in Javascript
The modulo operator, denoted by %, is an arithmetic
operator.
The modulo division operator produces the remainder of an
integer division.
Example - 20%5 = 0
21%6 = 3
What is the use of break statement ?
The break statement is used to "jumps out" of a loop.