Javascript Number

tutorial and example
tutorial and example

The Number object is a wrapper object which allows you to work with numerical values. The number object is created using the Number() constructor.It may be integer or floating-point.

Syntax

Examples

Try Now

Output

Description

The primary uses of the number object are:

  • If argument cannot be converted into a number, it returns NaN (Not a Number).
  • In a non-constructor context (i.e., without the new operator), Number can be used to perform a type conversion.

JavaScript Number Constants

Constant Description
MIN_VALUE It returns the largest minimum value.
MAX_VALUE It returns the largest maximum value.
POSITIVE_INFINITY It returns the positive infinity, overflow value.
NEGATIVE_INFINITY It returns the negative infinity, overflow value.
NaN It represent “Not a Number” value.