JAVASCRIPT ARITHMETHIC

Go down

JAVASCRIPT ARITHMETHIC

Post by Admin on Thu Oct 12, 2017 12:27 pm

A typical thing to do with numbers is arithmetic.

JavaScript Arithmetic Operators
Arithmetic operators perform arithmetic on numbers (literals or variables).

Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
++ Increment
-- Decrement

Arithmetic Operations
A typical arithmetic operation operates on two numbers.

The two numbers can be literals:

Example
var x = 100 + 50;

or variables:

Example
var x = a + b;

or expressions:

Example
var x = (100 + 50) * a;

Operators and Operands
The numbers (in an arithmetic operation) are called operands.

The operation (to be performed between the two operands) is defined by an operator.

Operand Operator Operand
100   + 50

The addition operator (+) adds numbers:

Adding
var x = 5;
var y = 2;
var z = x + y;

The subtraction operator (-) subtracts numbers.

Subtracting
var x = 5;
var y = 2;
var z = x - y;

The multiplication operator (*) multiplies numbers.

Multiplying
var x = 5;
var y = 2;
var z = x * y;

The division operator (/) divides numbers.

Dividing
var x = 5;
var y = 2;
var z = x / y;

The modular operator (%) returns the division remainder.

Modulus
var x = 5;
var y = 2;
var z = x % y;

The increment operator (++) increments numbers.

Incrementing
var x = 5;
x++;
var z = x;

The decrement operator (--) decrements numbers.

Decrementing
var x = 5;
x--;
var z = x;

Operator Precedence
Operator precedence describes the order in which operations are performed in an arithmetic expression.

Example
var x = 100 + 50 * 3;

As in traditional school mathematics, the multiplication is done first.

Multiplication (*) and division (/) have higher precedence than addition (+) and subtraction (-).

And (as in school mathematics) the precedence can be changed by using parentheses:

Example
var x = (100 + 50) * 3;

When using parentheses, the operations inside the parentheses are computed first.

When many operations have the same precedence (like addition and subtraction), they are computed from left to right:

Example
var x = 100 + 50 - 3;



For your question/clarification comment it below Smile

Admin
Admin
Admin

Posts : 26
Join date : 2017-09-15

View user profile http://junaimah.forumotion.asia

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by jalilahb on Sun Oct 15, 2017 5:17 am

Hello Ma'am Can you give more examples on "Operator Precedence" Thankyou po Smile

jalilahb
Master
Master

Posts : 7
Join date : 2017-10-15

View user profile

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Admin on Sun Oct 15, 2017 5:40 am

jalilahb wrote:Hello Ma'am Can you give more examples on "Operator Precedence" Thankyou po Smile

Thankyou jalilahb for the question Smile
Here are the examples for operator precedence:

Example
var x = (150 - 50) / 5;

var y = (350+432) *10;

var z = (491-1) / 10;

Admin
Admin
Admin

Posts : 26
Join date : 2017-09-15

View user profile http://junaimah.forumotion.asia

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by jalilahb on Sun Oct 15, 2017 5:52 am

Thank you mam junaimah for always responding to my questions hehehe.More power ! and Godbless po

jalilahb
Master
Master

Posts : 7
Join date : 2017-10-15

View user profile

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Admin on Sun Oct 15, 2017 6:04 am

jalilahb wrote:Thank you mam junaimah for always responding to my questions hehehe.More power ! and Godbless po

Always Welcome jalilahb Smile Gobless you too

Admin
Admin
Admin

Posts : 26
Join date : 2017-09-15

View user profile http://junaimah.forumotion.asia

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by janella on Mon Oct 16, 2017 7:32 pm

Hi maam junaimah ,... now i can use arithmetic javascript to compute my grades

janella
Member
Member

Posts : 3
Join date : 2017-10-16

View user profile

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by JuliaB on Mon Oct 16, 2017 7:32 pm

Does using multiple arithmetic operators, follows the PEMDAS rule?

JuliaB
Veteran
Veteran

Posts : 4
Join date : 2017-10-16

View user profile

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Lolita01 on Mon Oct 16, 2017 8:07 pm

JuliaB wrote:Does using multiple arithmetic operators, follows the PEMDAS rule?

I have the same question ma'am Junaimah with Julia B

Lolita01
Master
Master

Posts : 7
Join date : 2017-10-16

View user profile

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Lolita01 on Mon Oct 16, 2017 8:08 pm

janella wrote:Hi maam junaimah ,... now i can use arithmetic javascript to compute my grades

you gave me an idea janella in computing my grades thank you Smile

Lolita01
Master
Master

Posts : 7
Join date : 2017-10-16

View user profile

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Rtagudin on Mon Oct 16, 2017 8:34 pm

What is the advantage of javascript in other programming language?

Rtagudin
Member
Member

Posts : 3
Join date : 2017-10-16

View user profile

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Admin on Mon Oct 16, 2017 9:10 pm

janella wrote:Hi maam junaimah ,... now i can use arithmetic javascript to compute my grades

Hello janella Smile Glad to know that

Admin
Admin
Admin

Posts : 26
Join date : 2017-09-15

View user profile http://junaimah.forumotion.asia

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Admin on Mon Oct 16, 2017 11:40 pm

Lolita01 wrote:
JuliaB wrote:Does using multiple arithmetic operators, follows the PEMDAS rule?

I have the same question ma'am Junaimah with Julia B

Yes, juliaB and lolita PEMDAS rule is applied in Arithmetic Operators this condition is under Operator precedence.

Admin
Admin
Admin

Posts : 26
Join date : 2017-09-15

View user profile http://junaimah.forumotion.asia

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Admin on Mon Oct 16, 2017 11:44 pm

Rtagudin wrote:What is the advantage of javascript in other programming language?

JavaScript is a programming language that is run by most modern browsers. It supports object-oriented programming and procedural programming. It can be used to control web pages on the client side of the browser, server-side programs, and even mobile applications.
I think RTagudin the advantage of Javascript in other programming language is;both Java and JavaScript support many other languages. Cross-compilers convert many languages to run on Java's JVM or JavaScript engines. Java 8 now includes a mechanism for embedding JavaScript so Java can leverage several of JavaScript's benefits. Java gives the programming explicit control over threading.


Admin
Admin
Admin

Posts : 26
Join date : 2017-09-15

View user profile http://junaimah.forumotion.asia

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by KathrynB on Wed Oct 18, 2017 1:47 pm

Good Day! What is the importance of the JS Arithmetic in our everyday lives? Question

KathrynB
Master
Master

Posts : 5
Join date : 2017-10-18

View user profile

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by KathrynB on Wed Oct 18, 2017 1:51 pm

What is the difference between JavaScript and CSS? Question

KathrynB
Master
Master

Posts : 5
Join date : 2017-10-18

View user profile

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Admin on Wed Oct 18, 2017 2:04 pm

KathrynB wrote:What is the difference between JavaScript and CSS? Question

Hello KAthrynB Smile
The difference between JavaScript and CSS are:
JavaScript is an object-oriented computer programming language commonly used to create interactive effects within web browsers. While, CSS is a cascading style sheet (CSS) is a Web page derived from multiple sources with a defined order of precedence where the definitions of any style element conflict.

Admin
Admin
Admin

Posts : 26
Join date : 2017-09-15

View user profile http://junaimah.forumotion.asia

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Admin on Wed Oct 18, 2017 2:11 pm

KathrynB wrote:Good Day! What is the importance of the JS Arithmetic in our everyday lives? Question

Just like Math (JS Arithmethic) is very important in our daily lives, math is used all the time; it is very functional for our everyday living like going for shopping, buying we applied math. Actually, for every single thing we do, even we didn't realized it; we applied math believe it Smile

Admin
Admin
Admin

Posts : 26
Join date : 2017-09-15

View user profile http://junaimah.forumotion.asia

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Admin on Wed Oct 18, 2017 2:13 pm

How about the others? Can you share your thoughts about the importance of Js Arithmetic (math) in your every day life?

Admin
Admin
Admin

Posts : 26
Join date : 2017-09-15

View user profile http://junaimah.forumotion.asia

Back to top Go down

Re: JAVASCRIPT ARITHMETHIC

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum