If and If else statement:- these conditions helps to evaluates many block of codes,it controls the flow of the program based on whether the statement is true or false
let age = 19;
if (age >= 18) {
console.log("You are eligible for vote!");
}
else {
console.log("you are not eligible for vote");
}
operators in javaScript:-
operators are symbols used to perform calculations, compare values, and manipulate data types
Arithmetic operator:-
- (Addition): Adds numbers or links strings together
- (Subtraction): Subtracts one number from another
- (Multiplication): Multiplies two numbers / (Division): Divides numbers and outputs the quotient % (Modulus): Divides numbers and outputs the remaining fraction ** (Exponentiation): Raises a base number to a designated power
Assignment operator:-
= (Assignment): Stores a direct value into a variable.
+= (Addition Assignment): Adds a value to a variable, then saves the new sum
-= (Subtraction Assignment): Subtracts a value from a variable, then saves the new difference
*= (Multiplication Assignment): Multiplies a variable by a value, then saves the new total
/= (Division Assignment): Divides a variable by a value, then saves the new total
Comparison operator or relational operator:-
- Compare two values and output a boolean outcome
== (Loose Equality): Checks if values match, ignoring data types
=== (Strict Equality): Checks if both values and data types match
!= (Loose Inequality): Checks if values are unequal, ignoring data types
!== (Strict Inequality): Checks if values or data types are unequal.
, < (Greater / Less Than): Checks if the left side is larger or smaller
=, <= (Greater / Less Than or Equal): Checks boundaries on both sides.
Top comments (0)