القائمة الرئيسية

الصفحات

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 literals to instances of the number class.

Syntax

The syntax for creating a number object is as follows −

يمثل الكائن Number تاريخًا رقميًا ، إما أعداد صحيحة أو أرقام فاصلة عائمة. بشكل عام ، لا داعي للقلق بشأن كائنات الأرقام لأن المتصفح يقوم تلقائيًا بتحويل الأرقام الحرفية إلى حالات من فئة الأرقام. بناء الجملة بناء الجملة لإنشاء كائن رقمي كما يلي -

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 list of each property and their description.

Sr.No.Property & Description
1MAX_VALUE

The largest possible value a number in JavaScript can have 1.7976931348623157E+308

2MIN_VALUE

The smallest possible value a number in JavaScript can have 5E-324

3NaN

Equal to a value that is not a number.

4NEGATIVE_INFINITY

A value that is less than MIN_VALUE.

5POSITIVE_INFINITY

A value that is greater than MAX_VALUE

6prototype

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

7constructor

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.

هل اعجبك الموضوع :

تعليقات