Operators!!! What are they?
Operators are used to perform specific mathematical and logical computations on operands.
In other words we can say that operators operate the operands.
In javascript operators are used for compare values, perform arithmetic operations etc.
Arithemetic Opertors
-
+ Adds two numeric operands.
-
- Subtract right operand from left operand
-
* Multiply two numeric operands.
-
/ Divide left operand by right operand.
-
% Modulus operator. Returns remainder of two operands.
-
++ Increment operator. Increase operand value by one.
-
-- Decrement operator. Decrease value by one.
Comparison Operators
== Compares the equality of two operands without considering type.
=== Compares equality of two operands with type.
!= Compares inequality of two operands.
> Checks whether left side value is greater than right side value. If yes then returns true otherwise false.
< Checks whether left operand is less than right operand. If yes then returns true otherwise false.
>= Checks whether left operand is greater than or equal to right operand. If yes then returns true otherwise false.
<= Checks whether left operand is less than or equal to right operand. If yes then returns true otherwise false.
Logical Operators
&& && 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.
|| || is known as OR operator. It checks whether any one of the two operands is non-zero (0, false, undefined, null or "" is considered as zero).
! ! is known as NOT operator. It reverses the boolean result of the operand (or condition)
loops?? What are they. Loops are functios to operate a bloc of for a certain amount of time
two different types of loops
For loop
the for loop says :
for(let i = 0; i > 5; i ++){console.log (i)}
the while loop
the while loop says
let i = 5
while(i > 30){
console.log(i); i+3
}