
Operators
Logical operators in programming are like a set of tools that help us decide what to do depending on how things look. Logical operators tell the computer to do something based on how two different things compare.


Addition ^{Arithmetic Operators}

The addition operator returns the sum of two variables.
Javascript
Example of addition operator in javascript.
var age = 20; console.log(age + 1); // 21



Subtraction ^{Arithmetic Operators}

The subtraction operator returns the difference of two variables.
Javascript
Example of subtraction operator in javascript.
var age = 20; console.log(age  2); // 18



Multiplication ^{Arithmetic Operators}

The multiplication operator returns the product of two variables.
Javascript
Example of multiplication operator in javascript.
var age = 20; console.log(age * 3); // 60



Division ^{Arithmetic Operators}

The division operator returns the quotient of two variables.
Javascript
Example of division operator in javascript.
var age = 20; console.log(age / 2); // 10



Modulus ^{Arithmetic Operators}

The modulus operator returns the remainder of two variables.
Javascript
Example of modulus operator in javascript.
var age = 20; console.log(age % 9); // 2



Exponentiation ^{Arithmetic Operators}

The exponentiation operator returns the power of two variables.
Javascript
Example of exponentiation operator in javascript.
var age = 2; console.log(age ** 3); // 8



Equal ^{Comparison Operators}

The equal operator checks if two variables are equal value.
Javascript
Example of equal operator in javascript.
var age = 20; console.log(age == 20); // true



Equal Type ^{Comparison Operators}

The equal type operator checks if two variables are equal value and type.
Javascript
Example of equal type operator in javascript.
var age = '20'; console.log(age === '20'); // true



Not Equal ^{Comparison Operators}

The notequal operator checks if two variables are not equal value.
Javascript
Example of notequal operator in javascript.
var age = 20; console.log(age != 18); // true



Not Equal Type ^{Comparison Operators}

The notequal type operator checks if two variables are not equal value and type.
Javascript
Example of notequal type operator in javascript.
var age = 20; console.log(age !== '20'); // true



Greater Than ^{Comparison Operators}

The greaterthan operator checks if the value of the first variable is greater than the second.
Javascript
Example of greaterthan operator in javascript.
var age = 20; console.log(age > 18); // true



Less Than ^{Comparison Operators}

The lessthan operator checks if the value of the first variable is less than the second.
Javascript
Example of lessthan operator in javascript.
var age = 20; console.log(age < 21); // true



Greater Than or Equal ^{Comparison Operators}

The greaterthan or equalto operator checks if the value of the first variable is greater than or equal to the second.
Javascript
Example of greaterthan or equalto operator in javascript.
var age = 20; console.log(age >= 20); // true



Less Than or Equal ^{Comparison Operators}

The lessthan or equalto operator checks if the value of the first variable is less than or equal to the second.
Javascript
Example of lessthan or equalto operator in javascript.
var age = 20; console.log(age <= 20); // true

