Learning Javascript Part 4 : Arithmetic Operators In Javascript

0

Learn Javascript Part 4: Arithmetic Operators In Javascript is very in need at a time when we are making applications that require approximately logic that requires us to make calculations. be it a calculation in small numbers or calculations in very large quantities. to connect basic javascript tutorials at webspoint.net.

Learn Javascript Part 4: Arithmetic Operators In Javascript

Before any further calculation arithmetic operations brought in javascript, we will discuss first the operators that are available in javascript. can we use to make the math operations with javascript.

These are the operators that we can use in javascript to make the calculation of arithmetic

+ summation
Reduction
* Multiplication
/ apportionment
% Modulus
++ Increment
Decrement

 

How To Make The Calculation Of Arithmetic In Javascript?

It’s a very easy way, consider the following example.

in the above example, we create an instance of the summation. by filling out the values in the variables in the above there are two variables. i.e. variables bilangan1 and bilangan2. the variable bilangan1 contains the value 6. and the variable bilagan2 contains the value 2. then to sum it we just added the operators’ number just like the example above.

get here the summation variable already contains the result of bilangan1 in the Add bilangan2. 6 + 2. then the results we show on the element with an id of summation. (div tags). and the result.

See the Pen Calculation Of Arithmetic In Javascript by webspoints (@webspoints) on CodePen.

and it appears the results 8.

Another example.

and the result

See the Pen Calculation Of Arithmetic In Javascript 1 by webspoints (@webspoints) on CodePen.

Okay, the first tutorial Learn Javascript Part 4: Arithmetic Operators In Javascript. may be beneficial.

LEAVE A REPLY

Please enter your comment!
Please enter your name here