# 0.4 Phy1010: javascript  (Page 7/12)

 Page 7 / 12

## Arithmetic operators

The division operation in Listing 2 introduced the use of arithmetic operators.

In computer programming jargon, we speak of operators and operands. Operators operate on operands.

As a real-world example, if you were to go to the hospital for knee surgery, the surgeon would be the operator and you would be the operand . The surgeon would operate on you.

Binary operators

The operators that we will use in the modules in this collection will usually be restricted to those that have two operands, a left operand and a right operand . (Operators with two operands are commonly called binary operators .)

In the function named getHalf in Listing 2 , the "/" character is the division operator. The left operand is incomingParameter and the right operand is 2 . The result is that the incoming parameteris divided by the right operand (2).

Binary arithmetic operators

The binary arithmetic operators supported by JavaScript are shown in Figure 3 .

Figure 3 . Binary arithmetic operators.
```+ Addition: Adds the operands - Subtraction: Subtracts the right operand from the left operand* Multiplication: Multiplies the operands / Division: Divides the left operand by the right operand% Modulus: Returns integer remainder of dividing the left operand by the right operand```

We will use these operators extensively as we work through the physics exercises in future modules.

## Sequence

Of the four items listed under Structured programming earlier, the simplest one is sequence .

The concept of sequence in structured programming simply means that code statements can be executed in sequential order. Listing 2 provides a good example of the sequential execution of statements. The code in Listing 2 shows four sequential statements that begin with document.write.

## Selection

The next item that we will discuss from the list under Structured programming is selection . While not as simple as sequence , selection is something that you probably do many times each day without even thinking about it. Therefore, once you understand it, it isn'tcomplicated.

General syntax for selection statement

The general syntax for a selection statement (often called an if-else statement) is shown in Figure 4 .

Figure 4 . General syntax for selection statement.
```if(conditional expression is true){ execute code}else{//optional execute alternative code}//end selection statement```

A selection statement performs a logical test that returns either true or false. Depending on the result, specific code is executed to control thebehavior of the script.

A real-world analogy

Figure 5 shows a real-world analogy of a selection statement that you might make on your day off.

Figure 5 . Real-world analogy of a selection statement.
```if(it is not raining){ Play tennisGo for a walk Relax on the beach}else{//optional Make popcornWatch TV }//end selection statement```

In this analogy, you would check outside to confirm that it is not raining. If the condition is true (meaning that it isn't raining), you wouldplay tennis, go for a walk, and then relax on the beach. If it is raining, (meaning that the test condition is false), you would make some popcorn and relax in front of theTV.

where we get a research paper on Nano chemistry....?
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!