ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺺﯿﺼﺨﺗ


فهرست مطالب

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


ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫﺭﻮﺗﺍﺮﭘﺍ

.ﺪﻨﻫﺩ ﯽﻣ ﺹﺎﺼﺘﺧﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫﺮﯿﻐﺘﻣ ﻪﺑ ﺍﺭ ﯼﺮﯾﺩﺎﻘﻣ ﺏﺎﺴﺘﻧﺍ ﯼﺎﻫﺮﮕﻠﻤﻋ

Operator Example Same As
= x = y x = y
+= x += y x = x + y
-= x -= y x = x - y
*= x *= y x = x * y
/= x /= y x = x / y
%= x %= y x = x % y
**= x **= y x = x ** y

ﺖﻔﯿﺷ ﯼﺭﺍﺬﮔﺍﻭ ﯼﺎﻫﺭﻮﺗﺍﺮﭘﺍ

Operator Example Same As
<<= x <<= y x = x << y
>>= x >>= y x = x >> y
>>>= x >>>= y x = x >>> y

ﯽﺘﯿﺑ ﺏﺎﺴﺘﻧﺍ ﯼﺎﻫﺮﮕﻠﻤﻋ

Operator Example Same As
&= x &= y x = x & y
^= x ^= y x = x ^ y
|= x |= y x = x | y

ﯽﻘﻄﻨﻣ ﺺﯿﺼﺨﺗ ﯼﺎﻫﺮﮕﻠﻤﻋ

Operator Example Same As
&&= x &&= y x = x && (x = y)
||= x ||= y x = x || (x = y)
??= x ??= y x = x ?? (x = y)

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

ﺪﻨﺘﺴﻫ ES2020 ﯽﻘﻄﻨﻣ ﺺﯿﺼﺨﺗ ﯼﺎﻫﺮﮕﻠﻤﻋ


=ﺭﻮﺗﺍﺮﭘﺍ

Simple Assignment Operator ﺪﻫﺩ ﯽﻣ ﺹﺎﺼﺘﺧﺍ ﺮﯿﻐﺘﻣ ﮏﯾ ﻪﺑ ﺍﺭ ﯼﺭﺍﺪﻘﻣ.

ﻩﺩﺎﺳ ﻒﯿﻠﮑﺗ ﯼﺎﻫ ﻪﻧﻮﻤﻧ

let x = 10;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Simple Assignment</h2>
<h3>The = Operator</h3>

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

<script>
let x = 10;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>
let x = 10 + y;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Simple Assignment</h2>
<h3>The = Operator</h3>

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

<script>
let y = 50
let x = 10 + y;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

=+ ﺭﻮﺗﺍﺮﭘﺍ

Addition Assignment Operator ﺪﻨﮐ ﯽﻣ ﻪﻓﺎﺿﺍ ﺮﯿﻐﺘﻣ ﻪﺑ ﺭﺍﺪﻘﻣ ﮏﯾ.

ﻪﻓﺎﺿﺍ ﻒﯿﻠﮑﺗ ﯼﺎﻫ ﻪﻧﻮﻤﻧ

let x = 10;
x += 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Addition Assignment</h2>
<h3>The += Operator</h3>

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

<script>
let x = 10;
x += 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>
let text = "Hello";
text += " World";

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Addition Assignment</h2>
<h3>The += Operator</h3>

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

<script>
let text = "Hello";
text += " World";
document.getElementById("demo").innerHTML = text;
</script>

</body>
</html>

ﺭﻮﺗﺍﺮﭘﺍ=-

ﻖﯾﺮﻔﺗ ﺺﯿﺼﺨﺗ ﺮﮕﻠﻤﻋ ﺪﻨﮐ ﯽﻣ ﻢﮐ ﺮﯿﻐﺘﻣ ﮏﯾ ﺯﺍ ﺍﺭ ﯼﺭﺍﺪﻘﻣ.

ﻖﯾﺮﻔﺗ ﺺﯿﺼﺨﺗ ﻝﺎﺜﻣ

let x = 10;
x -= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Subtraction Assignment</h2>
<h3>The -= Operator</h3>

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

<script>
let x = 10;
x -= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

ﺭﻮﺗﺍﺮﭘﺍ =*

ﺏﺮﺿ ﺺﯿﺼﺨﺗ ﺭﻮﺗﺍﺮﭘﺍ ﺪﻨﮐ ﯽﻣ ﺏﺮﺿ ﺍﺭ ﺮﯿﻐﺘﻣ ﮏﯾ.

ﺏﺮﺿ ﻒﯿﻠﮑﺗ ﻝﺎﺜﻣ

let x = 10;
x *= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Multiplication Assignment</h2>
<h3>The *= Operator</h3>

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

<script>
let x = 10;
x *= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

ﺭﻮﺗﺍﺮﭘﺍ =**

ﯽﯾﺎﻤﻧ ﺺﯿﺼﺨﺗ ﺮﮕﻠﻤﻋ ﺪﻫﺩ ﯽﻣ ﺶﯾﺍﺰﻓﺍ ﺪﻧﻮﻠﻤﻋ ﻥﺍﻮﺗ ﻪﺑ ﺍﺭ ﺮﯿﻐﺘﻣ ﮏﯾ.

ﻥﺍﻮﺗ ﺺﯿﺼﺨﺗ ﻝﺎﺜﻣ

let x = 10;
x **= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Exponentiation Assignment</h2>
<h3>The **= Operator</h3>

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

<script>
let x = 10;
x **= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

=/ ﺭﻮﺗﺍﺮﭘﺍ

ﺶﺨﺑ ﯼﺭﺍﺬﮔﺍﻭ ﺭﻮﺗﺍﺮﭘﺍ ﺪﻨﮐ ﯽﻣ ﻢﯿﺴﻘﺗ ﺍﺭ ﺮﯿﻐﺘﻣ ﮏﯾ.

ﺶﺨﺑ ﻒﯿﻠﮑﺗ ﻪﻧﻮﻤﻧ

let x = 10;
x /= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Division Assignment</h2>
<h3>The /= Operator</h3>

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

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

</body>
</html>

ﺭﻮﺗﺍﺮﭘﺍ =%

Remainder Assignment Operator ﺪﻫﺩ ﯽﻣ ﺹﺎﺼﺘﺧﺍ ﺮﯿﻐﺘﻣ ﮏﯾ ﻪﺑ ﺍﺭ ﻩﺪﻧﺎﻤﯿﻗﺎﺑ.

ﻩﺪﻧﺎﻣ ﯽﻗﺎﺑ ﻒﯿﻠﮑﺗ ﻪﻧﻮﻤﻧ

let x = 10;
x %= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Remainder Assignment</h2>
<h3>The %= Operator</h3>

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

<script>
let x = 10;
x %= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>


ﺭﻮﺗﺍﺮﭘﺍ =>>

Operator ﭗﭼ ﺖﻤﺳ ﺮﯿﯿﻐﺗ ﯼﺭﺍﺬﮔﺍﻭ ﺪﻫﺩ ﯽﻣ ﺮﯿﯿﻐﺗ ﭗﭼ ﻪﺑ ﺍﺭ ﺮﯿﻐﺘﻣ ﮏﯾ.

ﭗﭼ Shift ﻒﯿﻠﮑﺗ ﻝﺎﺜﻣ

let x = -100;
x <<= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Left Shift Assignment</h2>
<h3>The &lt;&lt;= Operator</h3>

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

<script>
let x = -100;
x <<= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

ﺭﻮﺗﺍﺮﭘﺍ =<<

ﺭﻮﺗﺍﺮﭘﺍ ﺺﯿﺼﺨﺗ ﺖﻔﯿﺷ ﺖﺳﺍﺭ ﺪﻨﮐ ﯽﻣ ﺎﺠﺑﺎﺟ ﺖﺳﺍﺭ ﻪﺑ ﺍﺭ (ﺎﻀﻣﺍ) ﺮﯿﻐﺘﻣ ﮏﯾ.

ﺖﺳﺍﺭ ﺖﻔﯿﺷ ﺺﯿﺼﺨﺗ ﻝﺎﺜﻣ

let x = -100;
x >>= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Right Shift Assignment</h2>
<h3>The &gt;&gt;= Operator</h3>

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

<script>
let x = -100;
x >>= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

ﺭﻮﺗﺍﺮﭘﺍ =<<<

ﺖﻣﻼﻋ ﻥﻭﺪﺑ ﺖﻔﯿﺷ ﺺﯿﺼﺨﺗ ﺭﻮﺗﺍﺮﭘﺍ ﺪﻨﮐ ﯽﻣ ﺎﺠﺑﺎﺟ ﺖﺳﺍﺭ ﻪﺑ ﺍﺭ (ﺖﻣﻼﻋ ﻥﻭﺪﺑ) ﺮﯿﻐﺘﻣ ﮏﯾ.

ﺖﺳﺍﺭ ﻪﺑ ﺖﻣﻼﻋ ﻥﻭﺪﺑ ﻒﯿﻠﮑﺗ ﻦﯿﯿﻌﺗ ﻝﺎﺜﻣ

let x = -100;
x >>>= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Right Shift Assignment</h2>
<h3>The &gt;&gt;&gt;= Operator</h3>

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

<script>
let x = -100;
x >>>= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

=& ﺭﻮﺗﺍﺮﭘﺍ

Bitwise AND Assignment Operator ﯽﺘﯿﺑ ﻞﻤﻋ ﮏﯾ AND ﺪﻫﺩ ﯽﻣ ﻡﺎﺠﻧﺍ ﺪﻧﻮﻠﻤﻋ ﻭﺩ ﯼﻭﺭ.

Bitwise AND Assignment ﻝﺎﺜﻣ

let x = 10;
x &= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Bitwise AND Assignment</h2>
<h3>The &amp;= Operator</h3>

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

<script>
let x = 100;
x &= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

=| ﺭﻮﺗﺍﺮﭘﺍ

Bitwise OR Assignment Operator ﺕﺎﯿﻠﻤﻋ ﮏﯾ OR ﺪﻫﺩ ﯽﻣ ﻡﺎﺠﻧﺍ ﺪﻧﻮﻠﻤﻋ ﻭﺩ ﯼﻭﺭ ﺍﺭ ﯽﺘﯿﺑ.

OR ﯽﺘﯿﺑ ﻝﺎﺜﻣ

let x = 10;
x |= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Bitwise OR Assignment</h2>
<h3>The |= Operator</h3>

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

<script>
let x = 100;
x |= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

=^ﺭﻮﺗﺍﺮﭘﺍ

Bitwise XOR Assignment Operator ﺕﺎﯿﻠﻤﻋ ﮏﯾ XOR ﺪﻫﺩ ﯽﻣ ﻡﺎﺠﻧﺍ ﺪﻧﻮﻠﻤﻋ ﻭﺩ ﯼﻭﺭ ﺍﺭ ﯽﺘﯿﺑ.

ﯽﺘﯿﺑ XOR ﺺﯿﺼﺨﺗ ﻝﺎﺜﻣ

let x = 10;
x ^= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Bitwise XOR Assignment</h2>
<h3>The ^= Operator</h3>

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

<script>
let x = 100;
x ^= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

=&& ﺭﻮﺗﺍﺮﭘﺍ

ﯽﻘﻄﻨﻣ ﺺﯿﺼﺨﺗ ﺮﮕﻠﻤﻋ AND ﺩﻮﺷ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﺭﺍﺪﻘﻣ ﻭﺩ ﻦﯿﺑ.

.ﺩﻮﺷ ﯽﻣ ﻩﺩﺍﺩ ﺺﯿﺼﺨﺗ ﻡﻭﺩ ﺭﺍﺪﻘﻣ ،ﺪﺷﺎﺑ ﺖﺳﺭﺩ ﻝﻭﺍ ﺭﺍﺪﻘﻣ ﺮﮔﺍ

ﻒﯿﻠﮑﺗ ﻭ ﯽﻘﻄﻨﻣ ﻝﺎﺜﻣ

let x = 10;
x &&= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Logical AND Assignment</h2>
<h3>The &amp;&amp;= Operator</h3>
<p>If the first value is true, the second value is assigned.</p>

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

<script>
let x = 100;
x &&= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

.ﺖﺳﺍ ES2020 ﯽﮔﮋﯾﻭ ﮏﯾ &&= ﺭﻮﺗﺍﺮﭘﺍ


=|| ﺭﻮﺗﺍﺮﭘﺍ

ﯽﻘﻄﻨﻣ ﺺﯿﺼﺨﺗ ﺮﮕﻠﻤﻋ OR ﺩﻮﺷ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﺭﺍﺪﻘﻣ ﻭﺩ ﻦﯿﺑ.

.ﺩﻮﺷ ﯽﻣ ﻩﺩﺍﺩ ﺺﯿﺼﺨﺗ ﻡﻭﺩ ﺭﺍﺪﻘﻣ ،ﺪﺷﺎﺑ ﺖﺳﺭﺩﺎﻧ ﻝﻭﺍ ﺭﺍﺪﻘﻣ ﺮﮔﺍ

OR ﯽﻘﻄﻨﻣ ﻝﺎﺜﻣ

let x = 10;
x ||= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>Logical OR Assignment</h2>
<h3>The ||= Operator</h3>

<p>If the first value is false, the second value is assigned:</p>
<p id="demo"></p>

<script>
let x = undefined;
x ||= 5;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>

</body>
</html>

.ﺖﺳﺍ ES2020 ﯽﮔﮋﯾﻭ ﮏﯾ ||= ﺭﻮﺗﺍﺮﭘﺍ


ﺭﻮﺗﺍﺮﭘﺍ =??

ﻞﻃﺎﺑ ﻡﺎﻏﺩﺍ ﺺﯿﺼﺨﺗ ﺮﮕﻠﻤﻋ ﺩﻮﺷ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﺭﺍﺪﻘﻣ ﻭﺩ ﻦﯿﺑ.

.ﺩﻮﺷ ﯽﻣ ﻩﺩﺍﺩ ﺺﯿﺼﺨﺗ ﻡﻭﺩ ﺭﺍﺪﻘﻣ ،ﺪﺷﺎﺑ ﯽﻬﺗ ﺎﯾ ﻩﺪﺸﻧ ﻒﯾﺮﻌﺗ ﻝﻭﺍ ﺭﺍﺪﻘﻣ ﺮﮔﺍ

ﻞﻃﺎﺑ ﻡﺎﻏﺩﺍ ﺺﯿﺼﺨﺗ ﻝﺎﺜﻣ

let x;
x ??= 5;

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

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Assignments</h1>
<h2>The ??= Operator</h2>
<p>The ??= operator is used between two values. If the first value is undefined or null, the second value is assigned.</p>

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

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

</body>
</html>

.ﺖﺳﺍ ES2020 ﯽﮔﮋﯾﻭ ﮏﯾ ??= ﺭﻮﺗﺍﺮﭘﺍ