Skip to content

DataOps Blog

Just another DataOps site

  • Home
  • certification
  • consultant
  • consulting
  • Contact Us!
  • courses
  • Intro to Laravel
  • tools
  • trainer
  • training

What is JavaScript Operators?

December 22, 2021
By Manish Kumar In JavaScript

What is JavaScript Operators?

10 Simple & Effective tips to master JavaScript | by Bobby | Medium

In this tutorial, you will learn about different operators available in JavaScript and how to use them with the help of examples.

What is an Operator?

An operator in JavaScript, is a symbol that is used to perform any assigned particular operation to operands (values and variables). For example,

let x = 10;

let y = 20;

document.write(x + y);

output:-

30

Here + is an operator that performs addition, and x and y are operands.

JavaScript Operator Types

Here is a list of different operators you will learn in this tutorial.

  • Assignment Operators
  • Arithmetic Operators
  • Comparison Operators
  • Logical Operators
  • String Operators
  • Other Operators

JavaScript Assignment Operators

JavaScript Assignment Operators Example - Tuts Make

Assignment operators are used to assign any particular values to variables. For example,

let x = 10;

Here, the = operator is used to assign value 5 to variable x.

Here’s a list of commonly used assignment operators:

OperatorNameExample
“=”Assignment operatora = 7; // 7
“=+”Addition assignmenta += 5; // a = a + 5
“-+”Subtraction Assignmenta -= 2; // a = a – 2
“*=”Multiplication Assignmenta *= 3; // a = a * 3
“/=”Division Assignmenta /= 2; // a = a / 2
“%=”Remainder Assignmenta %= 2; // a = a % 2
“**=”Exponentiation Assignment 

JavaScript Arithmetic Operators

Arithmetic Operators in JavaScript Example - Tuts Make

Arithmetic operators are used to perform arithmetic calculations. For example,

const number = 10 + 20; // 30

Here, the + operator is used to add two operands.

OperatorNameExample
“+“Additionx + y
“–“Subtractionx – y
“*“Multiplicationx * y
“/“Divisionx / y
“%“Remainderx % y
“++“Increment (increments by 1)++x or x++
“—“Decrement (decrements by 1)–x or x–
“**“Exponentiation (Power)x ** y

JavaScript Comparison Operators

JavaScript Comparison Operators - Tuts Make

Comparison operators compare two values and return a boolean value, either true or false. Comparison operators are used in decision-making and loops. 

For example,

const a = 5, b = 4;
console.log(a > b); // true

Here, the comparison operator > is used to compare whether a is greater than b.

OperatorNameExample
“==“Equal to: returns true if the operands are equalx == y
“!=“Not equal to: returns true if the operands are not equalx != y
“===“Strict equal to: true if the operands are equal and of the same typex === y
“!==“Strict not equal to: true if the operands are equal but of different type or not equal at allx !== y
“>“Greater than: true if left operand is greater than the right operandx  > y
“>=“Greater than or equal to: true if left operand is greater than or equal to the right operandx >= y
“<“Less than: true if the left operand is less than the right operandx < y
“<=“Less than or equal to: true if the left operand is less than or equal to the right operandx <= y

Example of Comparision Operator

JavaScript Logical Operators

JavaScript Logical Operators Examples - Tuts Make

Logical operators perform logical operations and return a boolean value, either true or false.

Logical operators are used in decision making and loops. 

For example,

const x = 8, y = 9;

(x < 10) && (y < 20); // true

Here, && is the logical operator AND. Since both x < 10 and y < 20 are true, the result is true.

OperatorDescriptionExample
“&&“Logical AND: true if both the operands are true, else returns falsex && y
“||“Logical OR: true if either of the operands is true; returns false if both are falsex || y
“ ! “Logical NOT: true if the operand is false and vice-versa.!x

Example of Logical Operators in JavaScript

JavaScript String Operators
In JavaScript, you can also use the + operator to concatenate (join) two or more strings.

Example of String operators in JavaScript

Output:-

JavaScript is Awesome

Other JavaScript Operators
Here’s a list of other operators available in JavaScript. All this Operator is used as per requirment.

OperatorNameExample
“,“Evaluates multiple operands and returns the value of the last operandlet a = (1, 3 , 4); // 4
“?:“Returns value based on the condition(5 > 3) ? ‘success’ : ‘error’; // “success”
“delete“Deletes an object’s property, or an element of an arraydelete x
“typeof“Returns a string indicating the data typetypeof 3; // “number”
“void“Discards the expression’s return valuevoid(x)
“in“Returns true if the specified property is in the objectprop in object
“instanceof“Returns true if the specified object is of of the specified object typeinstanceof object_type

Thats all for now, i hope you like this particular blog on JavaScript Opertors.

Thank You !!!

css html javascript jquery logical operator operator
Written by:

Manish Kumar

View All Posts

Recent Posts

  • The Online Dating Association (ODA) Maintains the Gold Standard for online dating sites in britain
  • Tips Balance On The Internet And Typical Dating
  • meet black gay men Gay Hookups
  • (no title)
  • (no title)
  • Online Casinos Offer No Deposit Casino Bonus Codes
  • A Board Website Review
  • How you can Remove Disease From ipad device
  • Dating – When You Should Discuss Dirty Little Methods?
  • How to Find the Top Canadian Online Casino
  • Research Papers For Sale
  • Free Slot Machine Games – Tips to Play Slots Free
  • (no title)
  • Why Use a VPN Online?
  • The very best GTA Games
  • DesignLab Xbox 360 – Create Your Very Own Controllers
  • Tips on how to Conduct Individual Businesses
  • Tips on how to Download the Best Android Programs
  • Finest Antivirus Totally free
  • VPN USA — Protect Your web Privacy and Unblock Geo-Restricted Content

Archives

Categories

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
  • Free Video Tutorials
  • DevOps School
  • Best DevOps
  • scmGalaxy
  • Artificial Intelligence
  • DataOps
  • AIOps
  • GuruKul Galaxy
  • DevOps Consulting
  • DevOps Freelancers
  • DevOps Trainer
  • Free Ebooks
  • School for Debugger
  • Holiday Landmark
  • Surgery Planet
  • My Hospital Now
  • My Medic Plus
  • ProfessNow
  • Cotocus
  • Stocks Mantra
  • I Reviewed

Proudly powered by WordPress | Theme: BusiCare by SpiceThemes