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


فهرست مطالب

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


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

:ﺩﺮﮐ ﻩﺩﺎﻔﺘﺳﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫﻩﺭﺎﻤﺷ ﻪﻤﻫ ﺭﺩ ﻥﺍﻮﺗﯽﻣ ﺍﺭ ﯼﺩﺪﻋ ﯼﺎﻫﺵﻭﺭ ﻦﯾﺍ

toString()

ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻪﺘﺷﺭ ﺕﺭﻮﺻ ﻪﺑ ﺍﺭ ﯼﺩﺪﻋ

toExponential()

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺖﺳﺍ ﻩﺪﺷ ﻪﺘﺷﻮﻧ ﯽﯾﺎﻤﻧ ﺩﺎﻤﻧ ﺎﺑ ﻪﮐ ﺍﺭ ﯼﺩﺪﻋ

toFixed()

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺖﺳﺍ ﻩﺪﺷ ﻪﺘﺷﻮﻧ ﺭﺎﺸﻋﺍ ﯼﺩﺍﺪﻌﺗ ﺎﺑ ﻪﮐ ﺍﺭ ﯼﺩﺪﻋ

toPrecision()

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ ﺺﺨﺸﻣ ﻝﻮﻃ ﺎﺑ ﻩﺪﺷ ﻪﺘﺷﻮﻧ ﺩﺪﻋ ﮏﯾ

ValueOf()

ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺩﺪﻋ ﺕﺭﻮﺻ ﻪﺑ ﺍﺭ ﺩﺪﻋ ﮏﯾ


.()toString ﺪﺘﻣ

.ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻪﺘﺷﺭ ﻥﺍﻮﻨﻋ ﻪﺑ ﺍﺭ ﺩﺪﻋ ﮏﯾ toString() ﺵﻭﺭ

:ﺩﺮﮐ ﻩﺩﺎﻔﺘﺳﺍ (ﺕﺍﺭﺎﺒﻋ ﺎﯾ ﺎﻫﺮﯿﻐﺘﻣ ،ﯽﻈﻔﻠﻟﺍ) ﺩﺍﺪﻋﺍ ﻉﻮﻧ ﺮﻫ ﺭﺩ ﻥﺍﻮﺗﯽﻣ ﺍﺭ ﺩﺍﺪﻋﺍ ﯼﺎﻫﺵﻭﺭ ﻪﻤﻫ

ﻝﺎﺜﻣ

let x = 123;
x.toString();
(123).toString();
(100 + 23).toString();

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Number Methods</h2>

<p>The toString() method converts a number to a string.</p>

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

<script>
let x = 123;
document.getElementById("demo").innerHTML =
  x.toString() + "<br>" +
   (123).toString() + "<br>" +
   (100 + 23).toString();
</script>

</body>
</html>

toExponential() ﺵﻭﺭ

toExponential() ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻩﺪﺷ ﻪﺘﺷﻮﻧ ﯽﯾﺎﻤﻧ ﺩﺎﻤﻧ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ ﻭ ﻩﺪﺷ ﺩﺮﮔ ﺩﺪﻋ ﺎﺑ ﻪﺘﺷﺭ

:ﺪﻨﮐ ﯽﻣ ﺺﺨﺸﻣ ﺍﺭ ﺭﺎﺸﻋﺍ ﻪﻄﻘﻧ ﺖﺸﭘ ﯼﺎﻫﺮﺘﮐﺍﺭﺎﮐ ﺩﺍﺪﻌﺗ ﺮﺘﻣﺍﺭﺎﭘ ﮏﯾ

ﻝﺎﺜﻣ

let x = 9.656;
x.toExponential(2);
x.toExponential(4);
x.toExponential(6);

.ﺪﻨﮐ ﯽﻤﻧ ﺩﺮﮔ ﺍﺭ ﺩﺪﻋ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ،ﺪﯿﻨﮑﻧ ﺺﺨﺸﻣ ﺍﺭ ﻥﺁ ﺮﮔﺍ .ﺖﺳﺍ ﯼﺭﺎﯿﺘﺧﺍ ﺮﺘﻣﺍﺭﺎﭘ



toFixed() ﺪﺘﻣ

toFixed() ﯽﻣﺮﺑ ﻩﺭﺎﻤﺷ ﺎﺑ ﺍﺭ ﻪﺘﺷﺭ ﮏﯾﺪﻧﺍﺩﺮﮔ

ﻝﺎﺜﻣ

let x = 9.656;
x.toFixed(0);
x.toFixed(2);
x.toFixed(4);
x.toFixed(6);

toFixed(2) ﺖﺳﺍ ﯽﻟﺎﻋ ﻝﻮﭘ ﺎﺑ ﺭﺎﮐ ﯼﺍﺮﺑ.


.()toPrecision ﺵﻭﺭ

toPrecision() ﺎﺑ ﻩﺪﺷ ﻪﺘﺷﻮﻧ ﺩﺪﻋ ﮏﯾ ﺎﺑ ﺍﺭ ﻪﺘﺷﺭ ﮏﯾ

ﻝﺎﺜﻣ

let x = 9.656;
x.toPrecision();
x.toPrecision(2);
x.toPrecision(4);
x.toPrecision(6);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Number Methods</h2>

<p>The toPrecision() method returns a string, with a number written with a specified length:</p>

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

<script>
let x = 9.656;
document.getElementById("demo").innerHTML = 
  x.toPrecision() + "<br>" +
  x.toPrecision(2) + "<br>" +
  x.toPrecision(4) + "<br>" +
  x.toPrecision(6);  
</script>

</body>
</html>

.()valueOf ﺵﻭﺭ

valueOf() ﯽﻣﺮﺑ ﺩﺪﻋ ﻥﺍﻮﻨﻋ ﻪﺑ ﺍﺭ ﺩﺪﻋ ﮏﯾﺪﻧﺍﺩﺮﮔ.

ﻝﺎﺜﻣ

let x = 123;
x.valueOf();
(123).valueOf();
(100 + 23).valueOf();

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Number Methods</h2>

<p>The valueOf() method returns a number as a number:</p>

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

<script>
let x = 123;

document.getElementById("demo").innerHTML = 
  x.valueOf() + "<br>" +
  (123).valueOf() + "<br>" +
  (100 + 23).valueOf();
</script>

</body>
</html>

ﺪﺷﺎﺑ ﮏﯾ ﺎﯾ (ﺩﺪﻋ=ﻉﻮﻧ) ﻪﯿﻟﻭﺍ ﺭﺍﺪﻘﻣ ﮏﯾ ﺪﻧﺍﻮﺗ ﯽﻣ ﺩﺪﻋ ﮏﯾ ،ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﺩ

ﺩﻮﺷ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﻩﺭﺎﻤﺷ ﻞﯾﺪﺒﺗ ﯼﺍﺮﺑ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﺩ ﯽﻠﺧﺍﺩ ﺕﺭﻮﺻ ﻪﺑ valueOf() ﺵﻭﺭ

.ﺩﺭﺍﺪﻧ ﺩﻮﺟﻭ ﺎﻤﺷ ﺪﮐ ﺭﺩ ﻥﺁ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﯼﺍﺮﺑ ﯽﻠﯿﻟﺩ

.ﺪﻨﺘﺴﻫ toString() ﮏﯾ ﻭ valueOf() ﺵﻭﺭ ﮏﯾ ﯼﺍﺭﺍﺩ ﺖﭙﯾﺮﮑ


ﺩﺍﺪﻋﺍ ﻪﺑ ﺎﻫﺮﯿﻐﺘﻣ ﻞﯾﺪﺒﺗ

ﺩﺮﮐ ﻩﺩﺎﻔﺘﺳﺍ ﺎﻬﻧﺁ ﺯﺍ ﻥﺍﻮﺗ ﯽﻣ ﻪﮐ ﺩﺭﺍﺩ ﺩﻮﺟﻭ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺵﻭﺭ 3

Number()

.ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ ﺩﻮﺧ ﻥﺎﻣﻮﮔﺭﺁ ﺯﺍ ﻩﺪﺷ ﻞﯾﺪﺒﺗ ﺩﺪﻋ

parseFloat()

ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺭﻭﺎﻨﺷ ﺰﯿﻤﻣ ﺩﺪﻋ ﮏﯾ ﻭ ﺪﻨﮐ ﯽﻣ ﻪﯾﺰﺠﺗ ﺍﺭ ﻥﺁ ﻥﺎﻣﻮﮔﺭﺁ

parseInt()

ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ ﻞﻣﺎﮐ ﺩﺪﻋ ﮏﯾ ﻭ ﺪﻨﮐ ﯽﻣ ﻪﯾﺰﺠﺗ ﺍﺭ ﻥﺁ ﻥﺎﻣﻮﮔﺭﺁ

.ﺪﻨﺘﺴﻫ ﯽﻧﺎﻬﺟ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫ ﺵﻭﺭ ﺎﻬﻧﺁ .ﺪﻨﺘﺴﯿﻧ ﯼﺩﺪﻋ ﯼﺎﻫﺵﻭﺭ ﻻﺎﺑ ﯼﺎﻫﺵﻭﺭ


.()Number ﺵﻭﺭ

:ﺩﺮﮐ ﻩﺩﺎﻔﺘﺳﺍ ﺩﺍﺪﻋﺍ ﻪﺑ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫﺮﯿﻐﺘﻣ ﻞﯾﺪﺒﺗ ﯼﺍﺮﺑ ﻥﺍﻮﺗ ﯽﻣ Number() ﺵﻭﺭ ﺯﺍ

ﻝﺎﺜﻣ

Number(true);
Number(false);
Number("10");
Number("  10");
Number("10  ");
Number(" 10  ");
Number("10.33");
Number("10,33");
Number("10 33");
Number("John");

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Global Methods</h2>

<p>The Number() method converts variables to numbers:</p>

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

<script>
document.getElementById("demo").innerHTML = 
  Number(true) + "<br>" +
  Number(false) + "<br>" +
  Number("10") + "<br>" + 
  Number("  10") + "<br>" +
  Number("10  ") + "<br>" +
  Number(" 10  ") + "<br>" +
  Number("10.33") + "<br>" + 
  Number("10,33") + "<br>" +
  Number("10 33") + "<br>" +
  Number("John");
</script>

</body>
</html>


.ﺩﻮﺷ ﯽﻣ ﻩﺪﻧﺍﺩﺮﮔﺮﺑ (ﺩﺪﻋ ﮏﯾ ﻪﻧ) NaN ،ﺪﺷﺎﺒﻧ ﻞﯾﺪﺒﺗ ﻞﺑﺎﻗ ﺩﺪﻋ ﺮﮔﺍ


ﺎﻫ ﺦﯾﺭﺎﺗ ﺭﺩ ﻩﺩﺎﻔﺘﺳﺍ ﺩﺭﻮﻣ()Number ﺵﻭﺭ

Number() ﺪﻨﮐ ﻞﯾﺪﺒﺗ ﺩﺪﻋ ﻪﺑ ﺍﺭ ﺦﯾﺭﺎﺗ ﺪﻧﺍﻮﺗ ﯽﻣ ﻦﯿﻨﭽﻤﻫ.

ﻝﺎﺜﻣ

Number(new Date("1970-01-01"))

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Global Methods</h2>

<p>The Number() method can convert a date to a number:</p>

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

<script>
let x = new Date("1970-01-01");
document.getElementById("demo").innerHTML = Number(x); 
</script>

</body>
</html>


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

.ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ 1.1.1970 ﺯﺍ ﺍﺭ ﺎﻫ ﻪﯿﻧﺎﺛ ﯽﻠﯿﻣ ﺩﺍﺪﻌﺗ Date() ﺵﻭﺭ

:ﺖﺳﺍ 86400000 1970-01-01 ﻭ 1970-01-02 ﻦﯿﺑ ﻪﯿﻧﺎﺛ ﯽﻠﯿﻣ ﺩﺍﺪﻌﺗ

ﻝﺎﺜﻣ

Number(new Date("1970-01-02"))

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Global Methods</h2>

<p>The Number() method can convert a date to a number:</p>

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

<script>
let x = new Date("1970-01-02");
document.getElementById("demo").innerHTML = Number(x); 
</script>

</body>
</html>


ﻝﺎﺜﻣ

Number(new Date("2017-09-30"))

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Global Methods</h2>

<p>The Number() method can convert a date to a number:</p>

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

<script>
let x = new Date("2017-09-30");
document.getElementById("demo").innerHTML = Number(x); 
</script>

</body>
</html>



.()parseInt ﺪﺘﻣ

parseInt() ﺪﻨﺘﺴﻫ ﺎﻫﺎﻀﻓ .ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ ﻞﻣﺎﮐ ﺩﺪﻋ ﮏﯾ ﻭ ﺪﻨﮐ ﯽﻣ ﻪﯾﺰﺠﺗ ﺍﺭ ﻪﺘﺷﺭ ﮏﯾ

ﻝﺎﺜﻣ

parseInt("-10");
parseInt("-10.33");
parseInt("10");
parseInt("10.33");
parseInt("10 20 30");
parseInt("10 years");
parseInt("years 10");

.ﺩﻮﺷ ﯽﻣ ﻩﺪﻧﺍﺩﺮﮔﺮﺑ (ﺩﺪﻋ ﮏﯾ ﻪﻧ) NaN ،ﺪﺷﺎﺒﻧ ﻞﯾﺪﺒﺗ ﻞﺑﺎﻗ ﺩﺪﻋ ﺮﮔﺍ


.()parseFloat ﺵﻭﺭ

parseFloat() ﺪﻨﺘﺴﻫ ﺎﻫﺎﻀﻓ .ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ ﺩﺪﻋ ﮏﯾ ﻭ ﺪﻨﮐ ﯽﻣ ﻪﯾﺰﺠﺗ ﺍﺭ ﻪﺘﺷﺭ ﮏﯾ

ﻝﺎﺜﻣ

parseFloat("10");
parseFloat("10.33");
parseFloat("10 20 30");
parseFloat("10 years");
parseFloat("years 10");

.ﺩﻮﺷ ﯽﻣ ﻩﺪﻧﺍﺩﺮﮔﺮﺑ (ﺩﺪﻋ ﮏﯾ ﻪﻧ) NaN ،ﺪﺷﺎﺒﻧ ﻞﯾﺪﺒﺗ ﻞﺑﺎﻗ ﺩﺪﻋ ﺮﮔﺍ


ﯼﺩﺪﻋ ءﯽﺷ ﯼﺎﻫﺵﻭﺭ

:ﺖﺳﺍ Number ﯽﺷ ﻪﺑ ﻖﻠﻌﺘﻣ ﯽﺷ ﯼﺎﻫﺵﻭﺭ ﻦﯾﺍ

Number.isInteger()

ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ true ﺭﺍﺪﻘﻣ ﺪﺷﺎﺑ ﺢﯿﺤﺻ ﺩﺪﻋ ﮏﯾ ﻥﺎﻣﻮﮔﺭﺁ ﺮﮔﺍ

Number.isSafeInteger()

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ true ،ﺪﺷﺎﺑ ﻦﻣﺍ ﺢﯿﺤﺻ ﺩﺪﻋ ﮏﯾ ﻥﺎﻣﻮﮔﺭﺁ ﺮﮔﺍ

Number.parseFloat()

ﺪﻨﮐ ﯽﻣ ﻞﯾﺪﺒﺗ ﺩﺪﻋ ﻪﺑ ﺍﺭ ﻪﺘﺷﺭ ﮏﯾ

Number.parseInt()

ﺪﻨﮐ ﯽﻣ ﻞﯾﺪﺒﺗ ﻞﻣﺎﮐ ﺩﺪﻋ ﻪﺑ ﺍﺭ ﻪﺘﺷﺭ ﮏﯾ

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

.ﺪﻨﺘﺴﻫ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯽﺷ ﻩﺭﺎﻤﺷ ﻪﺑ ﻖﻠﻌﺘﻣ ﻻﺎﺑ ﯼﺩﺪﻋ ﯼﺎﻫﺵﻭﺭ

.ﺪﻨﺘﺴﻫ ﯽﺳﺮﺘﺳﺩ ﻞﺑﺎﻗ Number.isInteger() ﺪﻨﻧﺎﻣ ﻂﻘﻓ ﺎﻫﺵﻭﺭ ﻦﯾﺍ

:ﺩﻮﺷ ﯽﻣ ﺎﻄﺧ ﮏﯾ ﻪﺑ ﺮﺠﻨﻣ ،ﺖﺳﺍ ﺮﯿﻐﺘﻣ ﮏﯾ X ﻥﺁ ﺭﺩ ﻪﮐ()X.isInteger ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ

TypeError X.isInteger ﺖﺴﯿﻧ ﻊﺑﺎﺗ ﮏﯾ.


()Number.isInteger ﺵﻭﺭ

.ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ Number.isInteger() true ﺵﻭﺭ ،ﺪﺷ

ﻝﺎﺜﻣ

Number.isInteger(10);
Number.isInteger(10.5);

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Numbers</h1>
<h2>The isInteger() Method</h2>

<p>The isInteger() method returns true if the argument is an integer.</p>
<p>Otherwise it returns false.</p>

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

<script>
document.getElementById("demo").innerHTML =
Number.isInteger(10) + "<br>" + Number.isInteger(10.5);
</script>

</body>
</html>

Number.isSafeInteger() ﺵﻭﺭ

.ﺩﻮﺷ ﻩﺩﺍﺩ ﺶﯾﺎﻤﻧ ﺮﺑﺍﺮﺑ ﻭﺩ ﻖﯿﻗﺩ ﺩﺪﻋ ﮏﯾ ﻥﺍﻮﻨﻋ ﻪﺑ ﺪﻧﺍﻮﺗ ﯽﻣ ﺎﻘﯿﻗﺩ ﻪﮐ ﺖﺳﺍ ﺢﯿﺤﺻ ﺩﺪﻋ ﮏﯾ ﻦﻤﯾﺍ ﺢﯿﺤﺻ ﺩﺪﻋ ﮏﯾ

.ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ Number.isSafeInteger() true ﺵﻭﺭ

ﻝﺎﺜﻣ

Number.isSafeInteger(10);
Number.isSafeInteger(12345678901234567890);

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Numbers</h1>
<h2>The isSafeInteger() Method</h2>

<p>The isSafeInteger() method returns true if the argument is a safe integer.</p>
<p>Otherwise it returns false.</p>

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

<script>
document.getElementById("demo").innerHTML =
Number.isSafeInteger(10) + "<br>" + Number.isSafeInteger(12345678901234567890);
</script>

</body>
</html>


.ﺪﻨﺘﺴﻫ (sup>53 - 1>2)+ ﺎﺗ (sup>53 - 1>2)- ﺯﺍ ﺢﯿﺤﺻ ﺩﺍﺪﻋﺍ ﻪﻤﻫ ﻦﻣﺍ ﺢﯿﺤﺻ ﺩﺍﺪﻋﺍ


.()Number.parseFloat ﺵﻭﺭ

Number.parseFloat() ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ ﺩﺪﻋ ﮏﯾ ﻭ ﺪﻨﮐ ﯽﻣ ﻪﯾﺰﺠﺗ ﺍﺭ ﻪﺘﺷﺭ ﮏﯾ.

:ﺩﻮﺷ ﯽﻣ ﻩﺪﻧﺍﺩﺮﮔﺮﺑ ﻝﻭﺍ ﻩﺭﺎﻤﺷ ﻂﻘﻓ .ﺖﺳﺍ ﺯﺎﺠﻣ ﺎﻫﺎﻀﻓ

ﻝﺎﺜﻣ

Number.parseFloat("10");
Number.parseFloat("10.33");
Number.parseFloat("10 20 30");
Number.parseFloat("10 years");
Number.parseFloat("years 10");

.ﺩﻮﺷ ﯽﻣ ﻩﺪﻧﺍﺩﺮﮔﺮﺑ (ﺩﺪﻋ ﮏﯾ ﻪﻧ) NaN ،ﺪﺷﺎﺒﻧ ﻞﯾﺪﺒﺗ ﻞﺑﺎﻗ ﺩﺪﻋ ﺮﮔﺍ

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

Number Number.parseInt() ﯼﺎﻫﺵﻭﺭ

.(ﺮﮔﺭﻭﺮﻣ ﺯﺍ ﺝﺭﺎﺧ ﺭﺩ ﻪﺑﺎﺸﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺪﮐ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺖﻟﻮﻬﺳ ﯼﺍﺮﺑ) ﺖﺳﺍ ﺎﻫ ﯽﻧﺎﻬﺟ ﯼﺯﺎﺳﺭﻻﻭﮊﺎﻣ ﻑﺪﻫ


.()Number.parseInt ﺵﻭﺭ

Number.parseInt() ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ ﻞﻣﺎﮐ ﺩﺪﻋ ﮏﯾ ﻭ ﺪﻨﮐ ﯽﻣ ﻪﯾﺰﺠﺗ ﺍﺭ ﻪﺘﺷﺭ ﮏﯾ.

:ﺩﻮﺷ ﯽﻣ ﻩﺪﻧﺍﺩﺮﮔﺮﺑ ﻝﻭﺍ ﻩﺭﺎﻤﺷ ﻂﻘﻓ .ﺖﺳﺍ ﺯﺎﺠﻣ ﺎﻫﺎﻀﻓ

ﻝﺎﺜﻣ

Number.parseInt("-10");
Number.parseInt("-10.33");
Number.parseInt("10");
Number.parseInt("10.33");
Number.parseInt("10 20 30");
Number.parseInt("10 years");
Number.parseInt("years 10");

.ﺩﻮﺷ ﯽﻣ ﻩﺪﻧﺍﺩﺮﮔﺮﺑ (ﺩﺪﻋ ﮏﯾ ﻪﻧ) NaN ،ﺪﺷﺎﺒﻧ ﻞﯾﺪﺒﺗ ﻞﺑﺎﻗ ﺩﺪﻋ ﺮﮔﺍ

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

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

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

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

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