10.07.2017 Views

javascript_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Javascript<br />

Divide the numerator by the denominator<br />

Ex: B / A will give 2<br />

% (Modulus)<br />

5<br />

Outputs the remainder of an integer division<br />

Ex: B % A will give 0<br />

++ (Increment)<br />

6<br />

Increases an integer value by one<br />

Ex: A++ will give 11<br />

-- (Decrement)<br />

7<br />

Decreases an integer value by one<br />

Ex: A-- will give 9<br />

Note: Addition operator (+) works for Numeric as well as Strings. e.g. "a" + 10<br />

will give "a10".<br />

Example<br />

The following code shows how to use arithmetic operators in JavaScript.<br />

<br />

<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!