ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺕﺎﺒﺳﺎﺤﻣ


فهرست مطالب

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


ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯽﺑﺎﺴﺣ ﯼﺎﻫﺮﮕﻠﻤﻋ

.ﺪﻨﻫﺩ ﯽﻣ ﻡﺎﺠﻧﺍ ﺍﺭ ﺏﺎﺴﺣ (ﺎﻫﺮﯿﻐﺘﻣ ﺎﯾ ﯽﻈﻔﻠﻟﺍ) ﺩﺍﺪﻋﺍ ﯼﻭﺭ ﺮﺑ ﯽﺑﺎﺴﺣ ﯼﺎﻫﺮﮕﻠﻤﻋ

+

ﻥﺪﺷ ﻪﻓﺎﺿﺍ

-

ﻥﺩﺮﮐ ﺎﻬﻨﻣ

*

ﺏﺮﺿ

**

(ES2016) ﯼﺪﻨﻤﻧﺍﻮﺗ

/

ﺶﺨﺑ

%

(ﻩﺪﻧﺎﻣ ﯽﻗﺎﺑ) ﻝﻭﺪﻣ

++

ﺶﯾﺍﺰﻓﺍ

--

ﺶﻫﺎﮐ


ﯽﺑﺎﺴﺣ ﺕﺎﯿﻠﻤﻋ

.ﺪﻨﮐ ﯽﻣ ﻞﻤﻋ ﺩﺪﻋ ﻭﺩ ﯼﻭﺭ ﺮﺑ ﯽﻟﻮﻤﻌﻣ ﯽﺑﺎﺴﺣ ﺕﺎﯿﻠﻤﻋ ﮏﯾ

:ﺪﻨﺷﺎﺑ ﯽﻈﻔﻠﻟﺍ ﺖﺤﺗ ﺪﻨﻧﺍﻮﺗ ﯽﻣ ﺩﺪﻋ ﻭﺩ ﻦﯾﺍ

ﻝﺎﺜﻣ

let x = 100 + 50;

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Arithmetic</h2>
<p>A typical arithmetic operation takes two numbers and produces a new number.</p>

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

<script>
let x = 100 + 50;
document.getElementById("demo").innerHTML = x;
</script>

</body>
</html>

:ﺎﻫﺮﯿﻐﺘﻣ ﺎﯾ

ﻝﺎﺜﻣ

let x = a + b;

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Arithmetic</h2>
<p>A typical arithmetic operation takes two numbers (or variables) and produces a new number.</p>

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

<script>
let a = 100;
let b = 50;
let x = a + b;
document.getElementById("demo").innerHTML = x;
</script>

</body>
</html>

:ﺕﺍﺭﺎﺒﻋ ﺎﯾ

ﻝﺎﺜﻣ

let x = (100 + 50) * a;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>Arithmetic Operations</h2>
<p>A typical arithmetic operation takes two numbers (or expressions) and produces a new number.</p>

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

<script>
let a = 3;
let x = (100 + 50) * a;
document.getElementById("demo").innerHTML = x;
</script>

</body>
</html>

ﺎﻫﺭﻮﺗﺍﺮﭘﺍ ﻭ ﺎﻫﺭﻮﺗﺍﺮﭘﺍ

.ﺪﻧﻮﺷ ﯽﻣ ﻩﺪﯿﻣﺎﻧ ﺪﻧﻮﻠﻤﻋ (ﯽﺑﺎﺴﺣ ﺕﺎﯿﻠﻤﻋ ﮏﯾ ﺭﺩ) ﺩﺍﺪﻋﺍ

.ﺩﻮﺷ ﯽﻣ ﻒﯾﺮﻌﺗ ﺮﮕﻠﻤﻋ ﻂﺳﻮﺗ (ﺩﻮﺷ ﯽﻣ ﻡﺎﺠﻧﺍ ﺪﻧﻮﻠﻤﻋ ﻭﺩ ﻦﯿﺑ ﻪﮐ) ﺕﺎﯿﻠﻤﻋ

Operand Operator Operand
100 + 50


ﻥﺩﺮﻛ ﻪﻓﺎﺿﺍ

:ﺪﻨﮐ ﯽﻣ ﻪﻓﺎﺿﺍ ﺍﺭ ﺩﺍﺪﻋﺍaddition (+)> ﺮﮕﻠﻤﻋ

ﻝﺎﺜﻣ

let x = 5;
let y = 2;
let z = x + y;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>The + Operator</h2>

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

<script>
let x = 5;
let y = 2;
let z = x + y;
document.getElementById("demo").innerHTML = z;
</script>

</body>
</html>

ﻖﯾﺮﻔﺗ

.ﺪﻨﮐ ﯽﻣ ﻢﮐ ﺍﺭ ﺩﺍﺪﻋﺍ (-)/>ﻖﯾﺮﻔﺗ ﺮﮕﻠﻤﻋ

ﻝﺎﺜﻣ

let x = 5;
let y = 2;
let z = x - y;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>The - Operator</h2>

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

<script>
let x = 5;
let y = 2;
let z = x - y;
document.getElementById("demo").innerHTML = z;
</script>

</body>
</html>

ﻥﺩﺮﮐ ﺏﺮﺿ ﻝﺎﺣ ﺭﺩ

.ﺪﻨﮐ ﯽﻣ ﺏﺮﺿ ﺍﺭ ﺩﺍﺪﻋﺍ (*)/>ﺏﺮﺿ ﺮﮕﻠﻤﻋ

ﻝﺎﺜﻣ

let x = 5;
let y = 2;
let z = x * y;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>The * Operator</h2>

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

<script>
let x = 5;
let y = 2;
let z = x * y;
document.getElementById("demo").innerHTML = z;
</script>

</body>
</html>

ﻥﺩﺮﻛ ﻢﻴﺴﻘﺗ

.ﺪﻨﮐ ﯽﻣ ﻢﯿﺴﻘﺗ ﺍﺭ ﺩﺍﺪﻋﺍdivision (/)> ﺮﮕﻠﻤﻋ

ﻝﺎﺜﻣ

let x = 5;
let y = 2;
let z = x / y;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>The / Operator</h2>

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

<script>
let x = 5;
let y = 2;
let z = x / y;
document.getElementById("demo").innerHTML = z;
</script>

</body>
</html>

ﻩﺪﻧﺎﻣ ﯽﻗﺎﺑ

.ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﺍﺭ ﻢﯿﺴﻘﺗ ﻩﺪﻧﺎﻤﯿﻗﺎﺑmodulus (%)> ﺮﮕﻠﻤﻋ

ﻝﺎﺜﻣ

let x = 5;
let y = 2;
let z = x % y;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>The % Operator</h2>

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

<script>
let x = 5;
let y = 2;
let z = x % y;
document.getElementById("demo").innerHTML = z;
</script>

</body>
</html>

ﺪﻨﮐ ﯽﻣ ﺪﯿﻟﻮﺗ ﺐﯾﺮﺿﮏﯾ ﺢﯿﺤﺻ ﺩﺪﻋ ﻭﺩ ﻢﯿﺴﻘﺗ ،ﺏﺎﺴﺣ ﺭﺩ

.ﺖﺳﺍ ﯽﺑﺎﺴﺣ ﺖﻤﺴﻗﯽﻗﺎﺑ ﻝﻭﺪﻣ ﺕﺎﯿﻠﻤﻋ ﻪﺠﯿﺘﻧ ،ﺕﺎﯿﺿﺎﯾﺭ ﺭﺩ


ﺶﯾﺍﺰﻓﺍ ﻝﺎﺣ ﺭﺩ

.ﺪﻫﺩ ﯽﻣ ﺶﯾﺍﺰﻓﺍ ﺍﺭ ﺩﺍﺪﻋﺍincrement (++)> ﺮﮕﻠﻤﻋ

ﻝﺎﺜﻣ

let x = 5;
x++;
let z = x;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>The ++ Operator</h2>

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

<script>
let x = 5;
x++;
let z = x;
document.getElementById("demo").innerHTML = z;
</script>

</body>
</html>

ﺪﺑﺎﯾ ﯽﻣ ﺶﻫﺎﮐ

.ﺪﻫﺩ ﯽﻣ ﺶﻫﺎﮐ ﺍﺭ ﺩﺍﺪﻋﺍ (--)/>ﺶﻫﺎﮐ ﺮﮕﻠﻤﻋ

ﻝﺎﺜﻣ

let x = 5;
 x--;
let z = x;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>The -- Operator</h2>

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

<script>
let x = 5;
x--;
let z = x;
document.getElementById("demo").innerHTML = z;
</script>

</body>
</html>

ﯼﺪﻨﻤﻧﺍﻮﺗ

.ﺪﻫﺩ ﯽﻣ ﺶﯾﺍﺰﻓﺍ ﻡﻭﺩ ﺪﻧﻮﻠﻤﻋ ﻥﺍﻮﺗ ﻪﺑ ﺍﺭ ﻝﻭﺍ ﺪﻧﻮﻠﻤﻋ (**)/>ﯽﻧﺍﻮﺗ ﺮﮕﻠﻤﻋ

ﻝﺎﺜﻣ

let x = 5;
let z =
 x ** 2;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>The ** Operator</h2>

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

<script>
let x = 5;
document.getElementById("demo").innerHTML = x ** 2;
</script>

</body>
</html>

x ** y ﻪﺑﺎﺸﻣ ﻪﺠﯿﺘﻧ Math.pow(x,y) ﺪﻨﮐ ﯽﻣ ﺩﺎﺠﯾﺍ ﺍﺭ:

ﻝﺎﺜﻣ

let x = 5;
let z =
  Math.pow(x,2);

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

<!DOCTYPE html>
<html>
<body>

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

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

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

</body>
</html>

ﺭﻮﺗﺍﺮﭘﺍ ﺖﯾﻮﻟﻭﺍ

ﺪﻨﮐ ﯽﻣ ﻒﯿﺻﻮﺗ ﺍﺭ ﺩﻮﺷ ﯽﻣ ﻡﺎﺠﻧﺍ ﻥﺁ ﺭﺩ ﺕﺎﯿﻠﻤﻋ ﻪﮐ ﺍﺭ ﯽﺒﯿﺗﺮﺗ ﺮﮕﻠﻤﻋ ﻡﺪﻘﺗ

ﻝﺎﺜﻣ

let x = 100 + 50 * 3;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>Operator Precedence</h2>
<p>Multiplication has precedence over addition.</p>

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

<script>
document.getElementById("demo").innerHTML = 100 + 50 * 3;
</script>

</body>
</html>

ﺖﺳﺍ 100 ﻥﺎﻤﻫ ﺎﯾ ﺖﺳﺍ 3 * 150 ﻥﺎﻤﻫ ﻻﺎﺑ ﻝﺎﺜﻣ ﻪﺠﯿﺘﻧ ﺎﯾﺁ

؟ﺩﻮﺷ ﯽﻣ ﻡﺎﺠﻧﺍ ﺏﺮﺿ ﺎﯾ ﻊﻤﺟ ﺍﺪﺘﺑﺍ ﺎﯾﺁ

.ﺩﻮﺷ ﯽﻣ ﻡﺎﺠﻧﺍ ﺏﺮﺿ ﺍﺪﺘﺑﺍ ،ﯽﺘﻨﺳ ﻪﺳﺭﺪﻣ ﺕﺎﯿﺿﺎﯾﺭ ﺭﺩ ﻪﮐ ﺭﻮﻄﻧﺎﻤﻫ

ﺯﺍ ﺮﺗﻻﺎﺑ ﺖﯿﺟﻭﺍ ﯼﺍﺭﺍﺩ (/) ﻢﯿﺴﻘﺗ ﻭ (*

ﺩﺍﺩ ﺮﯿﯿﻐﺗ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ ﻡﺪﻘﺗ (ﻪﺳﺭﺪﻣ ﺕﺎﯿﺿﺎﯾﺭ ﺭﺩ ﻪﮐ ﺭﻮﻄﻧﺎﻤﻫ) ﻭ

ﺩﻮﺷ ﯽﻣ ﻪﺒﺳﺎﺤﻣ ﺰﺘﻧﺍﺮﭘ ﻞﺧﺍﺩ ﺕﺎﯿﻠﻤﻋ ،ﺰﺘﻧﺍﺮﭘ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﻡﺎﮕﻨﻫ

ﻝﺎﺜﻣ

let x = (100 + 50) * 3;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>Operator Precedence</h2>
<p>Multiplication has precedence over addition.</p>
<p>But parenthesis has precedence over multiplication.</p>

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

<script>
document.getElementById("demo").innerHTML = (100 + 50) * 3;
</script>

</body>
</html>

ﻭ ﻊﻤﺟ ﺪﻨﻧﺎﻣ) ﺪﻨﺘﺴﻫ ﻥﺎﺴﮑﯾ ﺖﯾﻮﻟﻭﺍ ﯼﺍﺭﺍﺩ ﺕﺎﯿﻠﻤﻋ ﺯﺍ ﯼﺭﺎﯿﺴﺑ ﻪﮐ ﯽﻣﺎﮕﻨﻫ

ﺎﻫ ﻝﺎﺜﻣ

let x = 100 + 50 - 3;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>Operator Precedence</h2>
<p>When many operations has the same precedence, they are computed from left to right.</p>

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

<script>
document.getElementById("demo").innerHTML = 100 + 50 - 3;
</script>

</body>
</html>
let x = 100 / 50 * 3;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Arithmetic</h1>
<h2>Operator Precedence</h2>
<p>When many operations has the same precedence, they are computed from left to right.</p>

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

<script>
document.getElementById("demo").innerHTML = 100 / 50 * 3;
</script>

</body>
</html>

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

:ﺪﯾﻭﺮﺑ ﺮﯾﺯ ﺱﺭﺩﺁ ﻪﺑ ﺮﮕﻠﻤﻋ ﺖﯾﻮﻟﻭﺍ ﺮﯾﺩﺎﻘﻣ ﺯﺍ ﻞﻣﺎﮐ ﺖﺴﯿﻟ ﮏﯾ ﯼﺍﺮﺑ

.ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﻮﺗﺍﺮﭘﺍ ﺖﯾﻮﻟﻭﺍ ﺮﯾﺩﺎﻘﻣ



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