Operators and Loops :
JavaScript Comparison Operators :
Operators | Description ———-|————
-
== equal to
-
=== equal value and equal type
-
!= not equal
-
!== not equal value or not equal type
-
(>) greater than
-
< less than
-
(>=) greater than or equal to
-
<= less than or equal to
JavaScript Logical Operators :
Operators | Description | ||
---|---|---|---|
&& | logical and | ||
< | > | logical or | |
! | logical not |
Example : Logical Operators
var a = 2 , b = 3 ;
-
(a>b) (a==b); return false -
(a!=b) && (a<b); return true
- !(a>b); return true
Loops:
-
For loop:
if you want to run the same code over and over again, each time with a different value.
syntax
for(initialzatin;condition;counter)
{
statements;
}
How it work ?
-
While loop :
The while loop loops through a block of code as long as a specified condition is true.
syntax
while(boolean condition)
{
statements; }