17.11.2015 Views

JavaScript_Succinctly

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

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

console.log(floatingPoint); // Logs '2.132'.<br />

<br />

Notes<br />

A numeric value can be a hexadecimal value or octal value in <strong>JavaScript</strong>, but this is<br />

typically not done.<br />

Number() parameters<br />

The Number() constructor function takes one parameter: the numeric value being<br />

created. In the following snippet, we create a number object for the value 456 called<br />

numberOne.<br />

Sample: sample51.html<br />

<br />

var numberOne = new Number(456);<br />

console.log(numberOne); // Logs '456{}'.<br />

<br />

Notes<br />

When used with the new keyword, instances from the Number() constructor produce a<br />

complex object. You should avoid creating number values using the Number()<br />

constructor (use literal/primitive numbers) due to the potential problems associated with<br />

the typeof operator. The typeof operator reports number objects as 'object' instead of<br />

the primitive label ('number') you might expect. The literal/primitive value is just more<br />

concise.<br />

Number() properties<br />

The Number() object has the following properties:<br />

Properties (e.g., Number.prototype;)<br />

MAX_VALUE<br />

MIN_VALUE<br />

NaN<br />

65

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

Saved successfully!

Ooh no, something went wrong!