How to create a Number object using JavaScript?

JavascriptWeb DevelopmentFront End Technology

The Number object represents a numerical date, either integers or floating-point numbers. The syntax for creating a number object is as follows −

var val = new Number(number);

The Number object without the new operator can be used to perform a type conversion. Let’s see an example of Number.MAX_VALUE property. The Number.MAX_VALUE property belongs to the static Number object.


Live Demo

            function showValue() {
               var val = Number.MAX_VALUE;
               document.write ("Value of Number.MAX_VALUE : " + val );
      <p>Click the following to see the result:</p>
         <input type="button" value="Click Me" onclick="showValue();" />
Updated on 17-Jun-2020 06:19:19