JavaScript & jQuery
-
Comparision operator
- = equal to
- is used for comparing two variables, but it ignores the datatype of variable
- === *equal value and equal type *
- is used for comparing two variables, but this operator also checks datatype and compares two values.
- != not equal
- The inequality operator (!=) checks whether its two operands are not equal, returning a Boolean result.
-
!== not equal value or not equal type * * *Not equal is an comparison operator which is used to check the value of two operands are equal or not. If the value of two operands are not equal it returns true.
- < * less than*
- Checks whether left operand is less than right operand. If yes then returns true otherwise false.
- > *greater than *
- Checks whether left side value is greater than right side value. If yes then returns true otherwise false.
- <= less than or equal to
- Checks whether left operand is less than or equal to right operand. If yes then returns true otherwise false.
- >== greater than or equal to * * *Checks whether left operand is greater than or equal to right operand. If yes then returns true otherwise false.
- = equal to
-
Logical operation
- && And
- && is known as AND operator. It checks whether two operands are non-zero (0, false, undefined, null or “” are considered as zero), if yes then returns 1 otherwise 0.
- OR
- is known as OR operator. It checks whether any one of the two operands is non-zero
- ! Not
- The inequality operator (!=) checks whether its two operands are not equal, returning a Boolean result.
- && And
-
Loops
Loops are handy, if you want to run the same code over and over again, each time with a different value.
- Kinds of Loops:
- For
loops through a block of code a number of times
for (statement 1 (is executed (one time) before the execution of the code block.); statement 2 (defines the condition for executing the code block.); statement 3 (is executed (every time) after the code block has been executed) ) { // code block to be executed }
- While
loops through a block of code while a specified condition is true
while (condition) { // code block to be executed}
- For
loops through a block of code a number of times