Quick Links
The JavaScript Number object represents numerical date, either integers or floating-point numbers. In general, you do not need to worry about Number objects because the browser automatically converts number literals to instances of the number class.
You can direct assign a number to a variable also. For example:
var x=102;//integer value
var y=102.7;//floating point value
var z=13e4;//exponent value, output: 130000
var n=new Number(16);//integer value by number object
Number Constants
Let’s see the list of JavaScript number constants with description.
- MIN_VALUE : returns the largest minimum value.
- MAX_VALUE : returns the largest maximum value.
- POSITIVE_INFINITY : returns positive infinity, overflow value.
- NEGATIVE_INFINITY : returns negative infinity, overflow value.
- NaN : represents “Not a Number” value.
Number Methods
Let’s see the list of JavaScript number methods with their description.
- isFinite() : It determines whether the given value is a finite number.
- isInteger() : It determines whether the given value is an integer.
- parseFloat() : It converts the given string into a floating point number.
- parseInt() : It converts the given string into an integer number.
- toExponential() : It returns the string that represents exponential notation of the given number.
- toFixed() : It returns the string that represents a number with exact digits after a decimal point.
- toPrecision() : It returns the string representing a number of specified precision.
- toString() : It returns the given number in the form of string.
Welcome to JavaScript!
JavaScript in Detail
External JavaScript
Syntax in JavaScript
Comments in JavaScript
Variables in JavaScript
Operators in JavaScript