Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • JS Tutorial
  • JS Exercise
  • JS Interview Questions
  • JS Array
  • JS String
  • JS Object
  • JS Operator
  • JS Date
  • JS Error
  • JS Projects
  • JS Set
  • JS Map
  • JS RegExp
  • JS Math
  • JS Number
  • JS Boolean
  • JS Examples
  • JS Free JS Course
  • JS A to Z Guide
  • JS Formatter
Open In App
Next Article:
Operator precedence in JavaScript
Next article icon

JavaScript Operators Reference

Last Updated : 04 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

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)); 

Output
Type 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:

JavaScript Arithmetic Operators

These are the operators that work on numerical values and then return a number. These are basically used to perform mathematical operations.

OPERATOR NAME

OPERATION

Addition (+)Add two numbers or concatenate the string.
Subtraction (-)Difference between the two operators.
Multiplication (*)Multiply two numbers.
Division (/)Find the quotient of two operands.
Modulus (%)Find the remainder of two operands.
Exponentiation (**)Raise the Left operator to the power of the right operator.
Increment (++)Increase the operand by one.
Decrement (–)Decrease the operand by one.
Unary Plus (+)Converts non-numbers to numbers.
Unary Negation (-)Converts operand to negative.

JavaScript Comparison Operators

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.

OPERATOR NAME

OPERATION

Equality (==)Compares the equality of two operators.
Inequality (!=)Compares inequality of two operators.
Strict Equality (===)Compares both value and type of the operand.
Strict Inequality (!==)Compares inequality with type.
Greater than (>)Checks if the left operator is greater than the right operator.
Greater than or equal (>=)Checks if the left operator is greater than or equal to the right operator.
Less than (<)Checks if the left operator is smaller than the right operator.
Less than or equal (<=)Checks if the left operator is smaller than or equal to the right operator.

JavaScript Logical Operators

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 NAMEOPERATION
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.

JavaScript Bitwise Operators

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. 

OPERATOR NAMEOPERATION
Bitwise AND (&)Returns true if both operands are true.
Bitwise OR (|)Returns true even if one operand is true.
Bitwise XOR (^)Returns true if both operands are different.
Bitwise NOT (~)Flips the value of the operand.
Bitwise Left Shift (<<)Shifts the bit toward left.
Bitwise Right Shift (>>)Shifts the bit towards the right.
Zero Fill Right Shift (>>>)Shifts the bit towards the right but adds 0 from the left.

JavaScript Assignment Operators

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.

OPERATOR NAMEOPERATION
Addition Assignment (+=)Add the value of the right operand to left and assign it to the left operand.
Subtraction Assignment (-=)Subtracts the value of the right operand to left and assigns it to the left operand.
Multiplication Assignment (*=)Multiplies the value of the right operand to left and assign it to the left operand.
Division Assignment (/=)Divides the value of the right operand by the left and assigns it to the left operand.
Remainder Assignment (%=)Finds the remainder after the division of the right operand with the left and assign it to the left operand.
Exponentiation Assignment (**=)Raises left operand to power of right operand and assign it to the left operand.
Left Shift Assignment (<<=)Moves the bits specified on the right operand to left and then assigns it to the left operand.
Right Shift Assignment (>>=)Moves the bits specified on the right operand to right and then assigns it to the left operand.
Bitwise AND Assignment (&=)Does a bitwise AND operation of both operands and assign it to the left operand.
Bitwise OR Assignment (|=)Does a bitwise OR operation of both operands and assign it to the left operand.
Bitwise XOR Assignment (^=)Does a bitwise XOR operation of both operands and assigns it to the left operand.

Few Important JavaScript Operators

OPERATOR NAMEOPERATION
Ternary (?:)Used as a simplified version of if-else to reduce code lines.
typeof A keyword to return the data type of the operand.
conditionalUsed to perform operations according to conditions.
instanceofUsed to check the type of operator at runtime.
DeleteUsed to delete JavaScript object properties.
in Keyword used to check if a property exists or not.
Spread (…)A new feature is used to expand iterables in form of an array.
comma (,)Used to separate operands.
GroupingUsed to override normal operator precedence.
Unary (+_) Converts the type of variable to the number.
Short circuitingUsed for evaluating an expression.
Nullish Coalescing (??) Used to return a value if the value is undefined or null.
Unsigned right bit shift (>>>)Used as unsigned right bit shift operator.
Pipeline (|>)Used to pipe the value of an expression to function.
Optional chaining (?.)Error-proof way to access nested object properties.
ArrowShortcut way of writing a function.

To learn about the precedence of these operators check this article Operator precedence in JavaScript



Next Article
Operator precedence in JavaScript
author
kartik
Improve
Article Tags :
  • JavaScript
  • Web Technologies
  • javascript-operators

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. There are various operators supported by JavaScript. 1. JavaScript Arithmetic OperatorsArithmetic Operators
    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. [GFGTABS] JavaScript // Lets take some variables x = 10 y = 20 x = y // Here, x is equal to 20 console.log(x); console.log(y); [/GFGTABS]Output20 20 More Assignment OperatorsThere are so many assignment operators as shown in
    6 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. [GFGTABS] JavaScript // Number + N
    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. [GFGTABS] JavaScript // Illustration of (==) operator let x = 5; let y = '5'; // Che
    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
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences