29.07.2016 Views

front-end-developer_1_

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

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

Front-End-Developer - Level 1<br />

4 - 3;<br />

5 * 6;<br />

10 / 2;<br />

9 / 2;<br />

7 + 8 * 9;<br />

(7 + 8) * 9;<br />

Try some other arithmetic yourself. Play around with the % operator, called modulo. It will<br />

give you the remainder of dividing two numbers. Don't be fooled into thinking it has<br />

something to do with percentages!<br />

+ , - , * , and / are called operators. An operator is a special character (or characters)<br />

that indicates an action to be performed.<br />

Try dividing 0 by 0. The result, NaN , stands for not a number. In JavaScript, NaN is actually<br />

considered a type of number (bizarre as that may seem).<br />

Try dividing any other number by 0. The result, Infinity , is also a number in JavaScript.<br />

Summary<br />

Cmd + Alt + J opens the JavaScript console in Chrome.<br />

Basic arithmetic works just like you'd expect:<br />

1 + 2;<br />

4 - 3;<br />

5 * 6;<br />

9 / 2;<br />

7 + 8 * 9;<br />

(7 + 8) * 9;<br />

+ , - , * , and / are called operators. An operator is a special character (or characters)<br />

that indicates an action to be performed.<br />

9 % 2 ; returns the remainder of 9 divided by 2. % is called modulo.<br />

0 / 0 ; returns NaN , which stands for not a number. NaN is a type of number.<br />

Infinity is also a number.<br />

Arithmetic<br />

97

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

Saved successfully!

Ooh no, something went wrong!