Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

Object Number in JavaScript

Explore Object Number in JavaScript with clear explanations, practical examples, and useful tips.

Table of Contents

This guide covers object number in JavaScript with practical context and easy-to-follow details. Use it to understand the subject and apply the information confidently.

Syntax

Syntax to create a Number Object as follows:

 var val = new Number ( number ); 

In the position of number, if you provide any non-numeric value, then the parameter cannot be converted to a number, it returns NaN (short for Not-a-Number).

The Properties of Number

Below is a list of its attributes and descriptions.

Properties Description

MAX_VALUE

The maximum possible value of some in JavaScript can be up to 1. 7976931348623157E + 308

MIN_VALUE

The smallest possible value of some in JavaScript can reach 5E-324

NaN

Equivalent to value that is not a number

NEGATIVE_INFINITY

A value less than MIN_VALUE

POSITIVE_INFINITY

A value greater than MAX_VALUE

Prototype

Static attribute of Number object. Use the prototype property to assign new properties and methods to the Number object in the current document

Constructor

Returns the function that creates the illustration of this object. By default, it is the Number object

The Methods of Number

The Number object contains only the default methods that are part of each object definition.

Method Description

ToExponential ()

Make some impressions in exponential form, even if this number is in a range in which JavaScript often uses standard notation.

ToFixed ()

A number format with a specific number of digits to the right of the decimal part.

ToLocaleString ()

Returns a string value version of the current number in a format that can be varied according to the browser internal setting.

ToPrecision ()

Define how many digits (including the digits on the right and left of the decimal part) to display a number.

ToString ()

Returns the string representation of the numeric value.

ValueOf ()

Returns the value of the number.

According to Tutorialspoint

Previous article: Objects in JavaScript

Next lesson: Boolean object in JavaScript

FAQ

What should I check before following these steps?

Confirm device and software compatibility, save important data, and make sure you have the required permissions, files, and account access.

Why might the process not work?

Common causes include outdated software, missing permissions, incompatible hardware, an unstable connection, or completing a step in the wrong order.

Can I undo the changes if necessary?

That depends on the tool or setting. Use built-in restore options when available, keep a backup, and record the original configuration first.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.