JAVASCRIPT ARITHMETHIC
Page 1 of 1 • Share
JAVASCRIPT ARITHMETHIC
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
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
Admin Admin
 Posts : 26
Join date : 20170915
Re: JAVASCRIPT ARITHMETHIC
Hello Ma'am Can you give more examples on "Operator Precedence" Thankyou po
jalilahb Master
 Posts : 7
Join date : 20171015
Re: JAVASCRIPT ARITHMETHIC
jalilahb wrote:Hello Ma'am Can you give more examples on "Operator Precedence" Thankyou po
Thankyou jalilahb for the question
Here are the examples for operator precedence:
Example
var x = (150  50) / 5;
var y = (350+432) *10;
var z = (4911) / 10;
Admin Admin
 Posts : 26
Join date : 20170915
Re: JAVASCRIPT ARITHMETHIC
Thank you mam junaimah for always responding to my questions hehehe.More power ! and Godbless po
jalilahb Master
 Posts : 7
Join date : 20171015
Re: JAVASCRIPT ARITHMETHIC
jalilahb wrote:Thank you mam junaimah for always responding to my questions hehehe.More power ! and Godbless po
Always Welcome jalilahb Gobless you too
Admin Admin
 Posts : 26
Join date : 20170915
Re: JAVASCRIPT ARITHMETHIC
Hi maam junaimah ,... now i can use arithmetic javascript to compute my grades
janella Member
 Posts : 3
Join date : 20171016
Re: JAVASCRIPT ARITHMETHIC
Does using multiple arithmetic operators, follows the PEMDAS rule?
JuliaB Veteran
 Posts : 4
Join date : 20171016
Re: JAVASCRIPT ARITHMETHIC
JuliaB wrote:Does using multiple arithmetic operators, follows the PEMDAS rule?
I have the same question ma'am Junaimah with Julia B
Lolita01 Master
 Posts : 7
Join date : 20171016
Re: JAVASCRIPT ARITHMETHIC
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
Lolita01 Master
 Posts : 7
Join date : 20171016
Re: JAVASCRIPT ARITHMETHIC
What is the advantage of javascript in other programming language?
Rtagudin Member
 Posts : 3
Join date : 20171016
Re: JAVASCRIPT ARITHMETHIC
janella wrote:Hi maam junaimah ,... now i can use arithmetic javascript to compute my grades
Hello janella Glad to know that
Admin Admin
 Posts : 26
Join date : 20170915
Re: JAVASCRIPT ARITHMETHIC
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
 Posts : 26
Join date : 20170915
Re: JAVASCRIPT ARITHMETHIC
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 objectoriented programming and procedural programming. It can be used to control web pages on the client side of the browser, serverside 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. Crosscompilers 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
 Posts : 26
Join date : 20170915
Re: JAVASCRIPT ARITHMETHIC
Good Day! What is the importance of the JS Arithmetic in our everyday lives?
KathrynB Master
 Posts : 5
Join date : 20171018
Re: JAVASCRIPT ARITHMETHIC
What is the difference between JavaScript and CSS?
KathrynB Master
 Posts : 5
Join date : 20171018
Re: JAVASCRIPT ARITHMETHIC
KathrynB wrote:What is the difference between JavaScript and CSS?
Hello KAthrynB
The difference between JavaScript and CSS are:
JavaScript is an objectoriented 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
 Posts : 26
Join date : 20170915
Re: JAVASCRIPT ARITHMETHIC
KathrynB wrote:Good Day! What is the importance of the JS Arithmetic in our everyday lives?
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
Admin Admin
 Posts : 26
Join date : 20170915
Re: JAVASCRIPT ARITHMETHIC
How about the others? Can you share your thoughts about the importance of Js Arithmetic (math) in your every day life?
Admin Admin
 Posts : 26
Join date : 20170915
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum

