Comparison Operators:
Comparison operators are used in logical statements to determine equality or difference between variables or values.
Logical Operators:
Logical operators are used to determine the logic between variables or values.
Conditional (Ternary) Operator:
JavaScript also contains a conditional operator that assigns a value to a variable based on some condition.
Syntax:
variablename = (condition) ? value1:value2
Comparing Different Types:
Comparing data of different types may give unexpected results.
When comparing a string with a number, JavaScript will convert the string to a number when doing the comparison. An empty string converts to 0. A non-numeric string converts to NaN which is always false.
Bitwise Operators:
Bit operators work on 32-bit numbers.
Any numeric operand in the operation is converted into a 32-bit number.
The result is converted back to a JavaScript number.
Example:
x = 5 & 1;
The result in x:
1