1 (edited by aliasm2k 2013-05-23 15:36)

Topic: Javascript Number object

Number object in Javascript is mainly used to convert between decimal, binary, octal and hexadecimal representations and to perform rounding off digits to a specific precision.

(function(con) {
    var oNum = new Number(2);
    var oNPi = new Number(Math.PI);
    console.log('Binary representation of 2: ' + oNum.toString(2)); //Prints 10
    console.log('Value of Pi: ' + Math.PI); //Prints value of Pi
    console.log('Value of Pi rounded to 4 decimal places: ' + oNPi.toFixed(4));

More about Number object at MDN https://developer.mozilla.org/en-US/doc … cts/Number