- Javascript - Page Printing
- Javascript - Void Keyword
- Javascript - Dialog Boxes
- Javascript - Page Redirect
- Javascript - Cookies
- Javascript - Events
- Javascript - Functions
- Javascript - Loop Control
- Javascript - For...in
- Javascript - For Loop
- Javascript - While Loop
- Javascript - Switch Case
- Javascript - If...Else
- Javascript - Operators
- Javascript - Variables
- Javascript - Placement
- Javascript - Enabling
- Javascript - Syntax
- Javascript - Overview
- Javascript - Home
JavaScript Objects
- Javascript - HTML DOM
- Javascript - RegExp
- Javascript - Math
- Javascript - Date
- Javascript - Arrays
- Javascript - Strings
- Javascript - Boolean
- Javascript - Number
- Javascript - Objects
JavaScript Advanced
- Javascript - Browsers
- Javascript - Image Map
- Javascript - Debugging
- Javascript - Multimedia
- Javascript - Animation
- Javascript - Validations
- Javascript - Error Handling
JavaScript Useful Resources
- Javascript - Resources
- Javascript - Functions
- Javascript - Quick Guide
- Javascript - Questions And Answers
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
JavaScript - The Number Object
The 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 pterals to instances of the number class.
Syntax
The syntax for creating a number object is as follows −
var val = new Number(number);
In the place of number, if you provide any non-number argument, then the argument cannot be converted into a number, it returns NaN (Not-a-Number).
Number Properties
Here is a pst of each property and their description.
Sr.No. | Property & Description |
---|---|
1 | The largest possible value a number in JavaScript can have 1.7976931348623157E+308 |
2 | The smallest possible value a number in JavaScript can have 5E-324 |
3 | Equal to a value that is not a number. |
4 | A value that is less than MIN_VALUE. |
5 | A value that is greater than MAX_VALUE |
6 | A static property of the Number object. Use the prototype property to assign new properties and methods to the Number object in the current document |
7 | Returns the function that created this object s instance. By default this is the Number object. |
In the following sections, we will take a few examples to demonstrate the properties of Number.
Number Methods
The Number object contains only the default methods that are a part of every object s definition.
Sr.No. | Method & Description |
---|---|
1 | Forces a number to display in exponential notation, even if the number is in the range in which JavaScript normally uses standard notation. |
2 | Formats a number with a specific number of digits to the right of the decimal. |
3 | Returns a string value version of the current number in a format that may vary according to a browser s local settings. |
4 | Defines how many total digits (including digits to the left and right of the decimal) to display of a number. |
5 | Returns the string representation of the number s value. |
6 | Returns the number s value. |
In the following sections, we will have a few examples to explain the methods of Number.
Advertisements