JavaScript & jQuery
JavaScript operators are symbols which are used to assign values, compare values, perform arithmetic operations, and more.
-
The variables (operations) are called operands.
-
The operation (to be performed between the two operands) is defined by an operator.
JavaScript supports the following types of operators.
-
Arithmetic Operators
-
Comparison Operators
-
Logical (or Relational) Operators
-
Assignment Operators
-
Conditional (or ternary) Operators
-
String Operators
-
Type Operators
-
Bitwise Operators
Comparison and Logical operators are used to test for true or false.
Example:-
-
if (age < 18) text = "Too young"; var voteable = (age < 18) ? "Too young":"Old enough"; // ternary operator
' if -else example age = Number(age); if (isNaN(age)) { voteable = "Input is not a number"; } else { voteable = (age < 18) ? "Too young" : "Old enough"; } '
Comparison and Logical operators are used to test for true or false. Logical operators are used to determine the logic between variables or values.


