Table of contents

#### JavaScript operators list

Programming languages in general are based on math operators such as multiplication, division, subtraction, and the minus, and the reason for this is to assign two separate values to the variables and then the need to extract solutions to equations later.

For this, we will highlight the JavaScript operators list, which will help you a lot while performing simple and complex equations, and if you want to imagine it in transformation equations and Projection in processing 2D graphics, you will use a lot of operators in this language to get a real answer on the computer screen.

#### Concepts

- Why operators are important.
- Definition.
- Use operators in string.

### Why operators are important?

Imagine if a programming language does not contain any operators, what is our situation today? Mathematical operators in programming were widely used before the emergence of high-level programming languages and were the basis of machine language like assembly language since ancient times, and this is what made it of absolute importance in the computer world.

### Definition

And in this lesson we will mention a javascript operators list that will enable you to know the Syntax of JavaScript:

- Mathematical: Simple math operators are used in the JavaScript language, such as addition, subtraction, and division, and these are some of their types:

<script> var x = 5; var y = 3; a = x + y; m = x * y; s = x - y; d = x / y; </script>

We defined all these variables, then variable a added x and y with the addition sign +, and variable m, which multiplied two values with the sign *, the variable s, which subtracted two values using the sign – and finally variable d, which divided the two variables using the / sign.

- Assignment operators : Assignment and equality operators between two values are the parameters that are used to equalize between two values or assign a value to another empty variable and the = sign is used to do this:

x = 10; y = x; docuemtn.write(y);

- Comparison & logical : You can use the comparison operator between two values that contain < or > signs also you can use logical operators if you want to check some values and usually you use it in conditional statement as follow :

let c = 10; let d = 20; if(c > d) { console.write("c is bigger!"); } else { console.write("No , d is bigger!"); } if(c == 10 || d == 15) { console.write("c = 10 and d != 15"); } if(c != d) { c = d; }

- Postfix & Prefix Operators: If you are unfamiliar with Postfix and Prefix, see the section on C++. JavaScript has provided us with Postfix and Prefix operators included in JavaScript operators list and you can use them whenever you like inside the code to influence the results of the values very precisely:

<script> x = 10; ++x; //prefix value console.write("X value became: " + x); --x; console.write("X value became: " + x); </script>

- Modulus operator: As you can see there are a way to create an modulus equation and don’t forget that modulus are very important with graphics programming such as looping or conditional phrases , simply here we can explain it like:

<script> x = 5; y = 13; document.write("x Modulus y is :" + x % y); </script>

By practicing all JavaScript we mentioned you will be able to use it quickly in your code and its very simple to do this with even all of programming languages , keep in mind that by using JavaScript operators list correctly you will save the time to understand hard algorithms in all of back end languages.

### Use operators in string

Addition operator is widely used in string variables and considering of that you can easily combine between two variables of string and it’s good idea for us to try something like this:

<script> var paragraph1="It's first combination between paragraph1"; var paragraph2="and paragraph2" window.alert(paragraph1+paragraph2); <script>

#### References

- Third edition JavaScript Book.