Category: 2. JavaScript Operators
-
Conditional Operators
JavaScript Conditional Operators The conditional operator in JavaScript first evaluates an expression for a true or false value and then executes one of the two given statements depending upon the result of the evaluation. The conditional operator is also known as the ternary operator. The JavaScript conditional (ternary) operator is only operator that takes three operands a condition followed…
-
Assignment Operators
JavaScript Assignment Operators The assignment operators in JavaScript are used to assign values to the variables. These are binary operators. An assignment operator takes two operands, assigns a value to the left operand based on the value of right operand. The left operand is always a variable and the right operand may be literal, variable or expression. An assignment operator first evaluates the expression and then…
-
Bitwise Operators
JavaScript Bitwise Operators The bitwise operators in JavaScript perform operations on the integer values at the binary level. They are used to manipulate each bit of the integer values. Bitwise operators are similar to logical operators but they work on individual bits. JavaScript bitwise operators works on 32-bits operands. In JavaScript, numbers are stored as…
-
Logical Operators
JavaScript Logical Operators The logical operators in JavaScript are generally used with Boolean operands and return a boolean value. There are mainly three types on logical operators in JavaScript – && (AND), || (OR), and ! (NOT). These operators are used to control the flow the program. Although the logical operators are typically used with Boolean values, they can…
-
Comparison Operators
JavaScript Comparison Operators The comparison operators in JavaScript compare two variables or values and return a boolean value, either true or false based on comparison result. For example, we can use the comparison operators to check whether two operands are equal or not. The comparison operators are used in logical expressions. A logical expression is…
-
Arithmetic Operators
JavaScript Arithmetic Operators Arithmetic operators in JavaScript perform mathematical calculations on numeric values (operands). Most of the arithmetic operators are binary operators as they perform calculations on two operands. Some arithmetic operators are unary operators. The unary operators perform computation on a single operand. JavaScript supports many arithmetic operators such as addition, subtraction, multiplication, division…
-
Operators
What is an Operator? In JavaScript, an operator is a symbol that performs an operation on one or more operands, such as variables or values, and returns a result. Let us take a simple expression 4 + 5 is equal to 9. Here 4 and 5 are called operands, and + is called the operator. JavaScript supports the following types of…