ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻩﺭﺎﻤﺷ ﯼﺎﻫ ﯽﮔﮋﯾﻭ


فهرست مطالب

    نمایش فهرست مطالب


EPSILON

.1 < ﺩﺪﻋ ﻦﯾﺮﺘﮑﭼﻮﮐ ﻭ 1 ﻦﯿﺑ ﺕﻭﺎﻔﺗ

MAX_VALUE

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﺩ ﻦﮑﻤﻣ ﺩﺍﺪﻌﺗ ﻦﯾﺮﺘﺸﯿﺑ

MIN_VALUE

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﺩ ﻦﮑﻤﻣ ﺩﺪﻋ ﻦﯾﺮﺘﮑﭼﻮﮐ

MAX_SAFE_INTEGER

(sup>53 - 1>2) ﻦﻣﺍ ﺢﯿﺤﺻ ﺩﺪﻋ ﺮﺜﮐﺍﺪﺣ

MIN_SAFE_INTEGER

(sup>53 - 1>2)- ﻦﻣﺍ ﺢﯿﺤﺻ ﺩﺪﻋ ﻞﻗﺍﺪﺣ

POSITIVE_INFINITY

(ﺰﯾﺭﺮﺳ ﺭﺩ ﺖﺸﮔﺮﺑ) ﺖﯾﺎﻬﻧ ﯽﺑ

NEGATIVE_INFINITY

(ﺰﯾﺭﺮﺳ ﺭﺩ ﺖﺸﮔﺯﺎﺑ) ﯽﻔﻨﻣ ﺖﯾﺎﻬﻧ ﯽﺑ

NaN

."Not-a-Number" ﺭﺍﺪﻘﻣ ﮏﯾ


ﻥﻮﻠﯿﺴﭘﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

Number.EPSILON ﻦﯿﺑ ﺕﻭﺎﻔﺗ

ﻝﺎﺜﻣ

let x = Number.EPSILON;

ﺪﯿﺷﺎﺑ ﻪﺘﺷﺍﺩ ﻪﺟﻮﺗ

Number.EPSILON ﯽﮔﮋﯾﻭ ﮏﯾ ES6 ﺖﺳﺍ.

.ﺪﻨﮐ ﯽﻤﻧ ﺭﺎﮐ ﺭﺭﻮﻠﭙﺴﮐﺍ ﺖﻧﺮﺘﻨﯾﺍ ﺭﺩ


MAX_VALUE ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

Number.MAX_VALUE ﺪﻫﺩ ﯽﻣ ﻥﺎﺸﻧ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﺩ ﺍﺭ ﻦﮑﻤﻣ ﺩﺪﻋ ﻦﯾﺮﺘﮔﺭﺰﺑ ﻪﮐ ﺖﺳﺍ ﯽﺘﺑﺎﺛ.

ﻝﺎﺜﻣ

let x = Number.MAX_VALUE;

ﺩﺮﮐ ﻩﺩﺎﻔﺘﺳﺍ ﺎﻫﺮﯿﻐﺘﻣ ﯼﻭﺭ ﻥﺍﻮﺗ ﯽﻤﻧ ﺍﺭ ﺩﺍﺪﻋﺍ ﯼﺎﻫ ﯽﮔﮋﯾﻭ

.ﺖﺳﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻩﺭﺎﻤﺷ ءﯽﺷ ﻪﺑ ﻖﻠﻌﺘﻣ ﻩﺭﺎﻤﺷ ﯼﺎﻫﯽﮔﮋﯾﻭ

.ﺪﻨﺘﺴﻫ ﯽﺳﺮﺘﺳﺩ ﻞﺑﺎﻗ Number.MAX_VALUE ﻥﺍﻮﻨﻋﻪﺑ ﻂﻘﻓ ﺎﻫﯽﮔﮋﯾﻭ ﻦﯾﺍ

،ﺖﺳﺍ ﺭﺍﺪﻘﻣ ﮏﯾ ﺎﯾ ﺮﯿﻐﺘﻣ ﮏﯾ x ﻥﺁ ﺭﺩ ﻪﮐ ،x.MAX_VALUE ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ

ﻝﺎﺜﻣ

let x = 6;
x.MAX_VALUE

MIN_VALUE ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

Number.MIN_VALUE ﺪﻫﺩ ﯽﻣ ﻥﺎﺸﻧ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﺩ ﺍﺭ ﻦﮑﻤﻣ ﺩﺪﻋ ﻦﯾﺮﺘﻤﮐ ﻪﮐ ﺖﺳﺍ ﯽﺘﺑﺎﺛ.

ﻝﺎﺜﻣ

let x = Number.MIN_VALUE;

MAX_SAFE_INTEGER ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

Number.MAX_SAFE_INTEGER ﺪﻫﺩ ﯽﻣ ﻥﺎﺸﻧ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﺩ ﺍﺭ ﻦﻤﯾﺍ ﺢﯿﺤﺻ ﺩﺪﻋ ﺮﺜﮐﺍﺪﺣ.

Number.MAX_SAFE_INTEGER ﺖﺳﺍ (253 - 1).

ﻝﺎﺜﻣ

let x = Number.MAX_SAFE_INTEGER;

MIN_SAFE_INTEGER ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

Number.MIN_SAFE_INTEGER ﺪﻫﺩ ﯽﻣ ﻥﺎﺸﻧ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﺩ ﺍﺭ ﻦﻤﯾﺍ ﺢﯿﺤﺻ ﺩﺪﻋ ﻞﻗﺍﺪﺣ.

Number.MIN_SAFE_INTEGER -(253 - 1) ﺖﺳﺍ.

ﻝﺎﺜﻣ

let x = Number.MIN_SAFE_INTEGER;

ﺪﯿﺷﺎﺑ ﻪﺘﺷﺍﺩ ﻪﺟﻮﺗ

MAX_SAFE_INTEGER

.ﺪﻨﻨﮐ ﯽﻤﻧ ﺭﺎﮐ ﺭﺭﻮﻠﭙﺴﮐﺍ ﺖﻧﺮﺘﻨﯾﺍ ﺭﺩ ﺎﻬﻧﺁ



POSITIVE_INFINITY ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

ﻝﺎﺜﻣ

let x = Number.POSITIVE_INFINITY;

POSITIVE_INFINITY ﺩﻮﺷ ﯽﻣ ﻩﺪﻧﺍﺩﺮﮔﺮﺑ ﺰﯾﺭﺮﺳ ﺕﺭﻮﺻ ﺭﺩ:

let x = 1 / 0;

NEGATIVE_INFINITY ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

ﻝﺎﺜﻣ

let x = Number.NEGATIVE_INFINITY;

NEGATIVE_INFINITY ﺩﻮﺷ ﯽﻣ ﻩﺪﻧﺍﺩﺮﮔﺮﺑ ﺰﯾﺭﺮﺳ ﺭﺩ:

let x = -1 / 0;

ﺩﺪﻋ ﮏﯾ ﻪﻧ - NaN ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

NaN ﺖﺴﯿﻧ ﯽﻧﻮﻧﺎﻗ ﻩﺭﺎﻤﺷ ﮏﯾ ﻪﮐ ﺖﺳﺍ ﯼﺩﺪﻋ ﯼﺍﺮﺑ ﻩﺪﺷ ﻭﺭﺯﺭ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﻤﻠﮐ ﮏﯾ.

ﺎﻫ ﻝﺎﺜﻣ

let x = Number.NaN;

ﮏﯾ ﻪﻧ) ﺩﻮﺷ ﯽﻣ NaN ﻪﺑ ﺮﺠﻨﻣ ﯼﺩﺪﻋ ﺮﯿﻏ ﻪﺘﺷﺭ ﮏﯾ ﺎﺑ ﺕﺎﺒﺳﺎﺤﻣ ﻡﺎﺠﻧﺍ ﯼﺍﺮﺑ ﺵﻼﺗ

let x = 100 / "Apple";

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Numbers</h2>

<p>A number divided by a non-numeric string becomes NaN (Not a Number):</p>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = 100 / "Apple";
</script>

</body>
</html>

ﻞﻣﺎﮐ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻩﺭﺎﻤﺷ ﻊﺟﺮﻣ

:ﺪﯿﻨﮐ ﻪﻌﺟﺍﺮﻣ ﺎﻣ ﻪﺑ ،ﻩﺭﺎﻤﺷ ﻞﻣﺎﮐ ﻊﺟﺮﻣ ﮏﯾ ﯼﺍﺮﺑ

.ﻞﻣﺎﮐ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻩﺭﺎﻤﺷ ﻊﺟﺮﻣ

.ﺖﺳﺍ Number ﯼﺎﻫ ﺵﻭﺭ ﻭ ﺎﻫ ﯽﮔﮋﯾﻭ ﻡﺎﻤﺗ ﺯﺍ ﯽﯾﺎﻫ ﻪﻧﻮﻤﻧ ﻭ ﺕﺎﺤﯿﺿﻮﺗ ﯼﻭﺎﺣ ﻊﺟﺮﻣ

تمامی حقوق محفوظ است. © BasicIT.org • 2023-2024