×

Html & Html5

it training classes Logo

The World's best Software Development Study Portal

Js Number


Js number object enables you to represent a numeric value. Float number as well as integer number both can be included here.

We can also construct the number object using Number () constructor.


var n=new Number(value);

Let's take an example:-

<html>

<body>

   <p id="demo"> </p>

<script>

   var x=18;

   var y=12.7;//floating point value

   var n=new Number(50); {

   document.getElementById('demo').innerHTML= x + y + n;}

</script>

</body>

</html>

Output of this program

80.7



Some constants value are described below :-

Methods Description
MIN_VALUE return minimum number
MAX_VALUE returns maximum value
POSITIVE_INFINITY returns positive infinity, overflow value.
NEGATIVE_INFINITY returns negative infinity, overflow value.
NaN represents "Not a Number" value.


Some more methods and description below:-

Methods 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 a 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.






JS training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute