ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯽﺿﺎﯾﺭ ءﯽﺷ


فهرست مطالب

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

ﺪﯿﻫﺩ ﻡﺎﺠﻧﺍ ﻥﺁ ﯼﻭﺭ ﺍﺭ ﯽﺿﺎﯾﺭ ﯼﺎﻫﺭﺎﮐ ﺎﺗ ﺪﻫﺩ ﯽﻣ ﻩﺯﺎﺟﺍ ﺎﻤﺷ ﻪﺑ ﯽﺿﺎﯾﺭ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯽﺷ

ﻝﺎﺜﻣ

Math.PI;

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.PI</h2>

<p>Math.PI returns the ratio of a circle's circumference to its diameter:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.PI;
</script>

</body>
</html>

ﯽﺿﺎﯾﺭ ﯽﺷ

.ﺩﺭﺍﺪﻧ ﻩﺪﻧﺯﺎﺳ Math ﯽﺷ ،ءﺎﯿﺷﺍ ﺮﯾﺎﺳ ﻑﻼﺧ ﺮﺑ

.ﺖﺳﺍ ﺖﺑﺎﺛ ﯽﺿﺎﯾﺭ ﯽﺷ

.ﺩﺮﮐ ﻩﺩﺎﻔﺘﺳﺍ ﻝﻭﺍ ﯽﺿﺎﯾﺭ ﯽﺷ ﮏﯾ ﺩﺎﺠﯾﺍ ﻥﻭﺪﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ ﺕﺎﯿﺻﻮﺼﺧ ﻭ ﺎﻫﺪﺘﻣ ﻪﻤﻫ


(ﺖﺑﺎﺛ) ﯽﺿﺎﯾﺭ ﯼﺎﻫ ﯽﮔﮋﯾﻭ

.ﯽﮔﮋﯾﻭ.ﯽﺿﺎﯾﺭ<"code class="w3-codespan> :ﺖﺳﺍ ﻦﯾﺍ ﯽﺿﺎﯾﺭ ﯽﮔﮋﯾﻭ ﺮﻫ ﯼﺍﺮﺑ ﻮﺤﻧ

:ﺖﺷﺍﺩ ﯽﺳﺮﺘﺳﺩ ﺎﻬﻧﺁ ﻪﺑ ﯽﺿﺎﯾﺭ ﺕﺎﯿﺻﻮﺼﺧ ﻥﺍﻮﻨﻋ ﻪﺑ ﻥﺍﻮﺗ ﯽﻣ ﻪﮐ ﺪﻫﺩ ﯽﻣ ﻪﺋﺍﺭﺍ ﺍﺭ ﯽﺿﺎﯾﺭ ﺖﺑﺎﺛ 8 ﺖ

ﻝﺎﺜﻣ

Math.E        // returns Euler's number
Math.PI       // returns PI
Math.SQRT2    // returns the square root of 2
Math.SQRT1_2  // returns the square root of 1/2
Math.LN2      // returns the natural logarithm of 2
Math.LN10     // returns the natural logarithm of 10
Math.LOG2E    // returns base 2 logarithm of E
Math.LOG10E   // returns base 10 logarithm of E

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math Constants</h2>

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

<script>
document.getElementById("demo").innerHTML = 
"<p><b>Math.E:</b> " + Math.E + "</p>" +
"<p><b>Math.PI:</b> " + Math.PI + "</p>" +
"<p><b>Math.SQRT2:</b> " + Math.SQRT2 + "</p>" +
"<p><b>Math.SQRT1_2:</b> " + Math.SQRT1_2 + "</p>" +
"<p><b>Math.LN2:</b> " + Math.LN2 + "</p>" +
"<p><b>Math.LN10:</b> " + Math.LN10 + "</p>" +
"<p><b>Math.LOG2E:</b> " + Math.LOG2E + "</p>" +
"<p><b>Math.Log10E:</b> " + Math.LOG10E + "</p>";
</script>

</body>
</html>

ﯽﺿﺎﯾﺭ ﯼﺎﻫ ﺵﻭﺭ

(ﻩﺭﺎﻤﺷ)ﺵﻭﺭ.ﯽﺿﺎﯾﺭ<"code class="w3-codespan> :ﺖﺳﺍ ﻦﯾﺍ ﯽﺿﺎﯾﺭ ﺵﻭﺭ ﺮﻫ


ﺢﯿﺤﺻ ﺩﺪﻋ ﻪﺑ ﺩﺪﻋ

:ﺩﺭﺍﺩ ﺩﻮﺟﻭ ﺢﯿﺤﺻ ﺩﺪﻋ ﮏﯾ ﻪﺑ ﺩﺪﻋ ﮏﯾ ﻥﺩﺮﮐ ﺩﺮﮔ ﯼﺍﺮﺑ ﻝﻮﻤﻌﻣ ﺵﻭﺭ 4

Math.round(x)

x ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻩﺪﺷ ﺩﺮﮔ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﺍﺭ

Math.ceil(x)

x ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻥﺁ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﺍﺭ ﻩﺪﺷ ﺩﺮﮔ

Math.floor(x)

x ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻥﺁ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﺍﺭ ﻩﺪﺷ ﺩﺮﮔ

Math.trunc(x)

(ES6 ﺭﺩ ﺪﯾﺪﺟ) ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﺢﯿﺤﺻ ﺖﻤﺴﻗ


Math.round()

Math.round(x) ﮏﯾﺩﺰﻧﯽﻣﺮﺑ ﺍﺭ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺗﺪﻧ

ﺎﻫ ﻝﺎﺜﻣ

Math.round(4.6);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.round()</h2>

<p>Math.round(x) returns the value of x rounded to its nearest integer:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.round(4.6);
</script>

</body>
</html>
Math.round(4.5);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.round()</h2>

<p>Math.round(x) returns the value of x rounded to its nearest integer:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.round(4.5);
</script>

</body>
</html>
Math.round(4.4);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.round()</h2>

<p>Math.round(x) returns the value of x rounded to its nearest integer:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.round(4.4);
</script>

</body>
</html>

Math.ceil()

Math.ceil(x) ﺭﺍﺪﻘﻣ x ﻩﺪﺷ ﺩﺮﮔ ﻻﺎﺑ ﺪﻧ

ﻝﺎﺜﻣ

Math.ceil(4.9);
Math.ceil(4.7);
Math.ceil(4.4);
Math.ceil(4.2);
Math.ceil(-4.2);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.ceil()</h2>

<p>Math.ceil() rounds a number <strong>up</strong> to its nearest integer:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.ceil(4.4);
</script>

</body>
</html>

Math.floor()

Math.floor(x) ﺭﺍﺪﻘﻣ x ﻩﺪﺷ ﺩﺮﮔ ﻦﯿﯾﺎﭘ

ﻝﺎﺜﻣ

Math.floor(4.9);
Math.floor(4.7);
Math.floor(4.4);
Math.floor(4.2);
Math.floor(-4.2);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.floor()</h2>

<p>Math.floor(x) returns the value of x rounded <strong>down</strong> to its nearest integer:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.floor(4.7);
</script>

</body>
</html>

Math.trunc()

Math.trunc(x) ﺢﯿﺤﺻ ﺖﻤﺴﻗ x ﯽﻣﺮﺑ ﺍﺭﺪﻧﺍﺩﺮﮔ:

ﻝﺎﺜﻣ

Math.trunc(4.9);
Math.trunc(4.7);
Math.trunc(4.4);
Math.trunc(4.2);
Math.trunc(-4.2);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.trunc()</h2>

<p>Math.trunc(x) returns the integer part of x:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.trunc(4.7);
</script>

</body>
</html>

Math.sign()

:ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ Math.sign(x) ،ﺪﺷﺎﺑ ﺖﺒﺜﻣ ﺎﯾ ﯽﻬﺗ ،ﯽﻔﻨ

ﻝﺎﺜﻣ

Math.sign(-4);
Math.sign(0);
Math.sign(4);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.sign()</h2>

<p>Math.sign(x) returns if x is negative, null or positive:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.sign(4);
</script>

</body>
</html>

Math.trunc() ﻭ Math.sign() 2015 ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﺑ - ES6 ﺪﻧﺪﺷ ﻪﻓﺎﺿﺍ.



Math.pow()

Math.pow(x, y) ﺭﺍﺪﻘﻣ x ﻥﺍﻮﺗ ﻪﺑ ﺍﺭ y ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ:

ﻝﺎﺜﻣ

Math.pow(8, 2);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.pow()</h2>

<p>Math.pow(x,y) returns the value of x to the power of y:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.pow(8,2);
</script>

</body>
</html>

Math.sqrt()

Math.sqrt(x) ﺭﺬﺟ x ﯽﻣﺮﺑ ﺍﺭﺪﻧﺍﺩﺮﮔ:

ﻝﺎﺜﻣ

Math.sqrt(64);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.sqrt()</h2>

<p>Math.sqrt(x) returns the square root of x:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.sqrt(64);
</script>

</body>
</html>

Math.abs()

Math.abs(x) (ﺖﺒﺜﻣ) ﻖﻠﻄﻣ ﺭﺍﺪﻘﻣ x ﯽﻣﺮﺑ ﺍﺭﺪﻧﺍﺩﺮﮔ:

ﻝﺎﺜﻣ

Math.abs(-4.7);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.abs()</h2>

<p>Math.abs(x) returns the absolute (positive) value of x:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.abs(-4.7);
</script>

</body>
</html>

Math.sin()

Math.sin(x) ﻪﯾﻭﺍﺯ (1 ﻭ -1 ﻦﯿﺑ ﺭﺍﺪﻘﻣ) ﺱﻮﻨﯿﺳ x (ﻥﺎﯾﺩﺍﺭ

:ﺪﯿﻨﮐ ﻞﯾﺪﺒﺗ ﻥﺎﯾﺩﺍﺭ ﻪﺑ ﺍﺭ ﻪﺟﺭﺩ ﺪﯾﺎﺑ ،ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ ﻪﺟﺭﺩ ﺯﺍ ﻥﺎﯾﺩﺍﺭ ﯼﺎﺟ ﻪﺑ ﺪﯿﻫﺍﻮﺧ ﯽﻣ ﺮﮔﺍ

.x PI/180 ﻪﺟﺭﺩ ﺐﺴﺣ ﺮﺑ ﻪﯾﻭﺍﺯ=ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ ﻪﯾﻭﺍﺯ

ﻝﺎﺜﻣ

Math.sin(90 * Math.PI / 180);     // returns 1 (the sine of 90 degrees)

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.sin()</h2>

<p>Math.sin(x) returns the sin of x (given in radians):</p>
<p>Angle in radians = (angle in degrees) * PI / 180.</p>

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

<script>
document.getElementById("demo").innerHTML = 
"The sine value of 90 degrees is " + Math.sin(90 * Math.PI / 180);
</script>

</body>
</html>

Math.cos()

Math.cos(x) ﻪﯾﻭﺍﺯ (1 ﻭ -1 ﻦﯿﺑ ﺭﺍﺪﻘﻣ) ﺱﻮﻨﯿﺴﮐ x (ﻥﺎﯾﺩﺍ

:ﺪﯿﻨﮐ ﻞﯾﺪﺒﺗ ﻥﺎﯾﺩﺍﺭ ﻪﺑ ﺍﺭ ﻪﺟﺭﺩ ﺪﯾﺎﺑ ،ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ ﻪﺟﺭﺩ ﺯﺍ ﻥﺎﯾﺩﺍﺭ ﯼﺎﺟ ﻪﺑ ﺪﯿﻫﺍﻮﺧ ﯽﻣ ﺮﮔﺍ

.x PI/180 ﻪﺟﺭﺩ ﺐﺴﺣ ﺮﺑ ﻪﯾﻭﺍﺯ=ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ ﻪﯾﻭﺍﺯ

ﻝﺎﺜﻣ

Math.cos(0 * Math.PI / 180);     // returns 1 (the cos of 0 degrees)

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.cos()</h2>

<p>Math.cos(x) returns the cosine of x (given in radians):</p>
<p>Angle in radians = (angle in degrees) * PI / 180.</p>

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

<script>
document.getElementById("demo").innerHTML = 
"The cosine value of 0 degrees is " + Math.cos(0 * Math.PI / 180);
</script>

</body>
</html>

Math.min() / Math.max()

Math.min()Math.max()

ﻝﺎﺜﻣ

Math.min(0, 150, 30, 20, -8, -200);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.min()</h2>

<p>Math.min() returns the lowest value in a list of arguments:</p>

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

<script>
document.getElementById("demo").innerHTML =
Math.min(0, 150, 30, 20, -8, -200);
</script>

</body>
</html>

ﻝﺎﺜﻣ

Math.max(0, 150, 30, 20, -8, -200);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.max()</h2>

<p>Math.max() returns the highest value in a list of arguments.</p>

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

<script>
document.getElementById("demo").innerHTML =
Math.max(0, 150, 30, 20, -8, -200);
</script>

</body>
</html>

Math.random()

Math.random() ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ 1 ﻭ (ﻞﻣﺎﺷ) 0 ﻦﯿﺑ ﯽﻓﺩﺎﺼﺗ ﺩﺪ

ﻝﺎﺜﻣ

Math.random();

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.random()</h2>

<p>Math.random() returns a random number between 0 and 1:</p>

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

<p>Tip: Click on "Run" several times.</p>

<script>
document.getElementById("demo").innerHTML = Math.random();
</script>

</body>
</html>

.ﺖﺧﻮﻣﺁ ﺪﯿﻫﺍﻮﺧ ﺮﺘﺸﯿﺑ Math.random() ﺩﺭﻮﻣ ﺭﺩ ﺵﺯﻮﻣﺁ ﻦﯾﺍ


.()Math.log ﺪﺘﻣ

Math.log(x) ﯽﻌﯿﺒﻃ ﻢﺘﯾﺭﺎﮕﻟ x ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ.

:ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ ﺪﺷﺭ ﺯﺍ ﯽﻨﯿﻌﻣ ﺢﻄﺳ ﻪﺑ ﻥﺪﯿﺳﺭ ﯼﺍﺮﺑ ﻡﺯﻻ ﻥﺎﻣﺯ ﯽﻌﯿﺒﻃ ﻢﺘﯾﺭﺎﮕﻟ

ﺎﻫ ﻝﺎﺜﻣ

Math.log(1);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.log()</h2>

<p>Math.log() returns the natural logarithm of a number:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.log(1);
</script>

</body>
</html>
Math.log(2);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.log()</h2>

<p>Math.log() returns the natural logarithm of a number:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.log(2);
</script>

</body>
</html>
Math.log(3);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.log()</h2>

<p>Math.log() returns the natural logarithm of a number:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.log(3);
</script>

</body>
</html>

Math.E ﻭ Math.log() ﺪﻨﺘﺴﻫ ﻮﻠﻗﻭﺩ.

؟ﻢﯿﺳﺮﺑ 10 ﺩﺪﻋ ﻪﺑ ﺎﺗ ﻢﯿﻨﮐ ﺏﺮﺿ ﺍﺭ Math.E ﺪﯾﺎﺑ ﺮﺑﺍﺮﺑ ﺪﻨﭼ

Math.log(10);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.log()</h2>

<p>How many times must we multiply Math.E to get 10?</p>

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

<script>
document.getElementById("demo").innerHTML = Math.log(10);
</script>

</body>
</html>

.()Math.log2 ﺪﺘﻣ

Math.log2(x) 2 ﻪﯾﺎﭘ ﻢﺘﯾﺭﺎﮕﻟ x ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ.

؟ﻢﯿﺳﺮﺑ 8 ﺩﺪﻋ ﻪﺑ ﺎﺗ ﻢﯿﻨﮐ ﺏﺮﺿ ﺍﺭ 2 ﺪﯾﺎﺑ ﺭﺎﺑ ﺪﻨﭼ

Math.log2(8);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.log2()</h2>

<p>Math.log2() returns the base 2 logarithm of a number.</p>
<p>How many times must we multiply 2 to get 8?</p>

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

<script>
document.getElementById("demo").innerHTML = Math.log2(8);
</script>

</body>
</html>

.()Math.log10 ﺵﻭﺭ

Math.log10(x) 10 ﻪﯾﺎﭘ ﻢﺘﯾﺭﺎﮕﻟ x ﯽﻣﺮﺑ ﺍﺭﺪﻧﺍﺩﺮﮔ.

؟ﻢﯿﺳﺮﺑ 1000 ﻪﺑ ﺎﺗ ﻢﯿﻨﮐ ﺏﺮﺿ ﺍﺭ 10 ﺪﯾﺎﺑ ﺭﺎﺑ ﺪﻨﭼ

Math.log10(1000);

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Math.log10()</h2>

<p>Math.log10() returns the base 10 logarithm of a number.</p>
<p>How many times must we multiply 10 to get 1000?</p>

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

<script>
document.getElementById("demo").innerHTML = Math.log10(1000);
</script>

</body>
</html>

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯽﺿﺎﯾﺭ ﯼﺎﻫ ﺵﻭﺭ

abs(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﻖﻠﻄﻣ ﺭﺍﺪﻘﻣ

acos(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ ﺍﺭ x ﻦﯾﺯﻮﮐﺭﺁ

acosh(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﮏﯿﻟﻮﺑﺮﭙﯿﻫ ﻦﯾﺯﻮﮐﺭﺁ

asin(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ ﺍﺭ x ﻦﯿﺴﮐﺭﺁ

asinh(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﯽﻟﻮﻟﺬﻫ ﻥﺎﻤﮐ

atan(x)

.ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﻥﺎﯾﺩﺍﺭ PI/2 ﻭ PI/2- ﻦﯿﺑ ﯼﺩﺪﻋ ﺭﺍﺪﻘﻣ ﮏﯾ ﻥﺍﻮﻨﻋ ﻪﺑ ﺍﺭ x ﺖﻧﺍﮋﻧﺎﺗ

atan2(y, x)

ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ ﺩﻮﺧ ﯼﺎﻫ ﻥﺎﻣﻮﮔﺭﺁ ﺐﯾﺮﺿ ﻊﻃﺎﻘﺘﻣ

atanh(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﯽﻟﻮﻟﺬﻫ ﺱﺎﻤﻣ

cbrt(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﺐﻌﮑﻣ ﻪﺸﯾﺭ

ceil(x)

x ﺖﺳﺍ ﻩﺪﺷ ﺩﺮﮔ ﻻﺎﺑ ﺖﻤﺳ ﻪﺑ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﻪﮐ ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ

cos(x)

(ﺖﺳﺍ ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ x) ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﺱﻮﻨﯿﺴﮐ

cosh(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﯽﻟﻮﻟﺬﻫ ﺱﻮﻨﯿﺴﮐ

exp(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x

floor(x)

x ﺖﺳﺍ ﻩﺪﺷ ﺩﺮﮔ ﻦﯿﯾﺎﭘ ﺖﻤﺳ ﻪﺑ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﻪﮐ ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ

log(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x (E ﻪﯾﺎﭘ) ﯽﻌﯿﺒﻃ ﻢﺘﯾﺭﺎﮕﻟ

max(x, y, z, ..., n)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ ﺭﺍﺪﻘﻣ ﻦﯾﺮﺗﻻﺎﺑ ﺎﺑ ﺩﺪﻋ

min(x, y, z, ..., n)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺭﺍﺪﻘﻣ ﻦﯾﺮﺘﻤﮐ ﺎﺑ ﺍﺭ ﯼﺩﺪﻋ

pow(x, y)

ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ y ﻥﺍﻮﺗ ﻪﺑ ﺍﺭ x ﺭﺍﺪﻘﻣ

random()

ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ 1 ﻭ 0 ﻦﯿﺑ ﯽﻓﺩﺎﺼﺗ ﺩﺪﻋ ﮏﯾ

round(x)

x ﺪﻨﮐ ﯽﻣ ﺩﺮﮔ ﺢﯿﺤﺻ ﺩﺪﻋ ﻦﯾﺮﺘﮑﯾﺩﺰﻧ ﻪﺑ ﺍﺭ

sign(x)

.ﺩﺩﺮﮔ ﯽﻣﺮﺑ (1 ،0 ،1-) ﺪﺷﺎﺑ ﺖﺒﺜﻣ ﺎﯾ ﯽﻬﺗ ،ﯽﻔﻨﻣ x ﺮﮔﺍ

sin(x)

(ﺖﺳﺍ ﻥﺎﯾﺩﺍﺭ ﺐﺴﺣ ﺮﺑ x) ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ x ﺱﻮﻨﯿﺳ

sinh(x)

ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ x ﯽﻟﻮﻟﺬﻫ ﺱﻮﻨﯿﺳ

sqrt(x)

ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ x ﺭﺬﺟ

tan(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ ﻪﯾﻭﺍﺯ ﮏﯾ ﺱﺎﻤﻣ

tanh(x)

ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ ﺩﺪﻋ ﮏﯾ ﯽﻟﻮﻟﺬﻫ ﺱﺎﻤﻣ

trunc(x)

.ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ (x) ﺩﺪﻋ ﮏﯾ ﺢﯿﺤﺻ ﺖﻤﺴﻗ

ﯽﺿﺎﯾﺭ ﻞﻣﺎﮐ ﻊﺟﺮﻣ

.ﺪﯾﻭﺮﺑ ﺎﻣ ﯽﺿﺎﯾﺭ ءﯽﺷ ﻞﻣﺎﮐ ﻊﺟﺮﻣ ﻪﺑ ،ﻞﻣﺎﮐ ﻊﺟﺮﻣ ﮏﯾ ﯼﺍﺮﺑ

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

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