Hosting Solutions
mobile_logo Table of Contents


The JavaScript Number object sports a set of constants and methods for script authors when they work with numeric data.

var num1 = 5; var num2 = Number(5); var num3 = new Number(5);

All three of the approaches above are acceptable syntax for establishing a number object.


MAX_VALUE - represents the maximum value. MIN_VALUE - represents the minimum value. NaN - represents not a number value. NEGATIVE_INFINITY - represents negative infinite value. POSITIVE_INFINITY - represents positive infinite value. var v1 = Number.MAX_VALUE; var v2 = Number.MIN_VALUE; var v3 = Number.NaN; var v4 = Number.NEGATIVE_INFINITY; var v5 = Number.POSITIVE_INFINITY; Properties of the number object are constants, which means they are values that do not change.


toExponential - returns exponential notation of a number. toFixed - returns fixed point notation of a number. toPrecision - returns fixed point notation to a specified precision. toString - return a string that represents the number(convert number to string object). valueOf - return the primitive value of a number. var num = 50; var exn = num.toExponential(2); var fix = num.toFixed(3); var pre = num.toPrecision(5); var str = num.toString(); var val = num.valueOf();