Operators are symbols that operate on values or data. The data on which an operator operates is called an operand. The different types of operators are - Arithmetic operators, Comparison operators, Logical operators, Bitwise operators, Assignment operators, Ternary operators, Concatenation operators, and Type operators.
Let us take a look at each one of them:
-
Arithmetic operators take numeric values as their operands, perform an action and return a single numeric value.
+ - * % / ++ --
-
Comparison operands are used to compare two operands. These operators return boolean results (true or false).
== === != !==
-
Logical operators are used to combine two or more conditions into a single expression and return a boolean result (true or false).
&& || !
-
Assignment operators are used to assign value to variables. Ternary operators take three operators and return a boolean value.
= += -=
-
Concatenation operators are used to append two strings.
let message = "Welcome to" + "BI"; console.log("Result of String Operator: " +message);
-
Type operators are a collection of operators available to assist us when we are working with objects in TypeScript.
in delete typeof instanceof