JAVASCRIPT NUMBER

Lavanya



JavaScript Number Object


The JavaScript Number object allows you to represent numeric values, either as integers or floating-point numbers. It adheres to the IEEE standard for representing floating-point numbers.


With the help of the Number() constructor, you can create a Number object in JavaScript. For example

Syntax:

<Script>

let variableName = new Number(numberValue);

</Script>


If a value cannot be converted to a number, the Number() constructor returns NaN (Not a Number), which can be verified using the isNaN() method.


You can also directly assign a number to a variable. For example:

Example


<Script>

let num = 123;
console.log(num); 

</Script>

Output: 

123


JavaScript number constants


Here is a list of JavaScript number constants along with their descriptions.



JavaScript number method


Here is a list of JavaScript number methods along with their descriptions.







Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send