JavaScript Operators Reference
Last Updated :
04 Jul, 2024
JavaScript Operators are used to perform specific mathematical and logical computations on operands. In other words, an operator operates the operands. In JavaScript, operators are used to compare values, perform arithmetic operations, etc.
Example: In this example, we will use typeof operator to check the type of variable.
JavaScript
let a = 17;
let b = "GeeksforGeeks";
let c = "";
let d = null;
console.log("Type of a = " + (typeof a));
console.log("Type of b = " + (typeof b));
console.log("Type of c = " + (typeof c));
console.log("Type of d = " + (typeof d));
console.log("Type of e = " + (typeof e));
OutputType of a = number
Type of b = string
Type of c = string
Type of d = object
Type of e = undefined
The Complete List of JavaScript Operators is listed below:
These are the operators that work on numerical values and then return a number. These are basically used to perform mathematical operations.
These are the operators that are used to perform equality or difference comparisons between the values. It checks whether an element is greater, smaller equal, or unequal to the other element.
These are the operators which allow us to compare variables or values. The logical operator is mostly used to make decisions based on conditions specified for the statements. It can also be used to manipulate a boolean or set termination conditions for loops.
OPERATOR NAME | OPERATION |
---|
NOT (!) | Converts operator to boolean and returns flipped value. |
AND (&&) | Evaluates operands and return true only if all are true. |
OR (||) | Returns true even if one of the multiple operands is true. |
These operators convert the number to a 32-bit binary number and perform the bitwise operation. The number is converted back to the 64-bit number after the result.
These operators assign the value of the right-hand operand to its left-hand operand. That is if a = b assigns the value of b to a.
Few Important JavaScript Operators
To learn about the precedence of these operators check this article Operator precedence in JavaScript
Similar Reads
Operator precedence in JavaScript Operator precedence refers to the priority given to operators while parsing a statement that has more than one operator performing operations in it. Operators with higher priorities are resolved first. But as one goes down the list, the priority decreases and hence their resolution. ( * ) and ( / )
2 min read
JavaScript String Operators JavaScript String Operators are used to manipulate and perform operations on strings. There are two operators which are used to modify strings in JavaScript. These operators help us to join one string to another string.1. Concatenate OperatorConcatenate Operator in JavaScript combines strings using
3 min read
JavaScript Operators JavaScript operators are symbols or keywords used to perform operations on values and variables. They are the building blocks of JavaScript expressions and can manipulate data in various ways.JavaScript OperatorsThere are various operators supported by JavaScript.1. JavaScript Arithmetic OperatorsAr
5 min read
JavaScript Bitwise Operators In JavaScript, a number is stored as a 64-bit floating-point number but bitwise operations are performed on a 32-bit binary number. To perform a bit-operation, JavaScript converts the number into a 32-bit binary number (signed) and performs the operation and converts back the result to a 64-bit numb
5 min read
JavaScript Operators Coding Practice Problems Operators in JavaScript allow you to perform operations on variables and values, including arithmetic, logical, bitwise, comparison, and assignment operations. Mastering JavaScript operators is essential for writing efficient expressions and conditional statements. This curated list of JavaScript op
1 min read
JavaScript Assignment Operators Assignment operators are used to assign values to variables in JavaScript.JavaScript// Lets take some variables x = 10 y = 20 x = y ; console.log(x); console.log(y); Output20 20 More Assignment OperatorsThere are so many assignment operators as shown in the table with the description.OPERATOR NAMESH
5 min read
JavaScript Arithmetic Operators JavaScript Arithmetic Operators are the operator that operate upon the numerical values and return a numerical value. Addition (+) OperatorThe addition operator takes two numerical operands and gives their numerical sum. It also concatenates two strings or numbers.JavaScript// Number + Number =>
6 min read
JavaScript Addition (+) Operator JavaScript addition (+) operator is one of the most fundamental and widely used arithmetic operators in JavaScript. It is used to perform arithmetic addition on numbers but also concatenate strings. Syntaxa + bWhere - a: The first value (number, string, or another data type).b: The second value (num
1 min read
JavaScript Comparison Operators JavaScript comparison operators are essential tools for checking conditions and making decisions in your code. 1. Equality Operator (==) The Equality operator is used to compare the equality of two operands. JavaScript// Illustration of (==) operator let x = 5; let y = '5'; // Checking of operands c
5 min read
JavaScript Course Operators in JavaScript An operator is capable of manipulating a certain value or operand. Operators are used to performing specific mathematical and logical computations on operands. In other words, we can say that an operator operates the operands. In JavaScript, operators are used for comparing values, performing arithm
7 min read