ﺪﻨﮐ ﯽﻣ ﻒﯿﺻﻮﺗ ﺍﺭ ﺩﻮﺷ ﯽﻣ ﻡﺎﺠﻧﺍ ﻥﺁ ﺭﺩ ﺕﺎﯿﻠﻤﻋ ﻪﮐ ﺍﺭ ﯽﺒﯿﺗﺮﺗ ﺮﮕﻠﻤﻋ ﻡﺪﻘﺗ
ﺯﺍ ﺮﺗﻻﺎﺑ ﺖﯿﺟﻭﺍ ﯼﺍﺭﺍﺩ (/
) ﻢﯿﺴﻘﺗ ﻭ (<
:ﺩﻮﺷ ﯽﻣ ﻡﺎﺠﻧﺍ ﺏﺮﺿ ﺍﺪﺘﺑﺍ ،ﯽﺘﻨﺳ ﺕﺎﯿﺿﺎﯾﺭ ﺭﺩ ﻪﮐ ﺭﻮﻄﻧﺎﻤﻫ
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>
:ﺩﻮﺷ ﯽﻣ ﻪﺒﺳﺎﺤﻣ ﺰﺘﻧﺍﺮﭘ ﻞﺧﺍﺩ ﺕﺎﯿﻠﻤﻋ ﺍﺪﺘﺑﺍ ،ﺰﺘﻧﺍﺮﭘ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﻡﺎﮕﻨﻫ
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>
ﺪﻧﻮﺷ ﯽﻣ ﻪﺒﺳﺎﺤﻣ ﺕﺭﺎﺒﻋ ﻪﯿﻘﺑ ﺯﺍ ﻞﺒﻗ ﺰﺘﻧﺍﺮﭘ ﻞﺧﺍﺩ ﺕﺍﺭﺎﺒﻋ
ﺩﻮﺷ ﯽﻣ ﺍﺮﺟﺍ ﺕﺭﺎﺒﻋ ﻪﯿﻘﺑ ﺭﺩ ﻪﺠﯿﺘﻧ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺯﺍ ﻞﺒﻗ ﻊﺑﺎﺗ
( )
ﺖﯾﻮﻟﻭﺍ: 18
ﻥﺎﯿﺑ ﯼﺪﻨﺑ ﻩﻭﺮﮔ
<!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>
: ﻝﺎﺜﻣ
(100 + 50) * 3
.
ﺖﯾﻮﻟﻭﺍ: 17
ﻮﻀﻋ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>The . Operator</h2>
<p>Car name is:</p>
<p id="demo"></p>
<script>
const car = {type:"Fiat", model:"500", color:"white"};
document.getElementById("demo").innerHTML = car.type;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
person.name
[]
ﺖﯾﻮﻟﻭﺍ: 17
ﻮﻀﻋ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>The [] Operator</h2>
<p>Car name is:</p>
<p id="demo"></p>
<script>
const car = {type:"Fiat", model:"500", color:"white"};
document.getElementById("demo").innerHTML = car["type"];
</script>
</body>
</html>
: ﻝﺎﺜﻣ
person["name"]
?.
ﺖﯾﻮﻟﻭﺍ: 17
ﯼﺭﺎﯿﺘﺧﺍ ﯼﺪﻨﺑﺮﯿﺠﻧﺯ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>The ?. Operator</h2>
<p>The ?. operator returns undefined if an object is undefined or null (instead of throwing an error).</p>
<p>Car name is:</p>
<p id="demo"></p>
<script>
const car = {type:"Fiat", model:"500", color:"white"};
let name = car?.name;
document.getElementById("demo").innerHTML = name;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x ?. y
ﺖﯾﻮﻟﻭﺍ:
: ﻝﺎﺜﻣ
()
ﺖﯾﻮﻟﻭﺍ: 17
ﻊﺑﺎﺗ ﯽﻧﺍﻮﺧﺍﺮﻓ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Functions</h1>
<p>Call a function which performs a calculation and returns the result:</p>
<p id="demo"></p>
<script>
function myFunction(p1, p2) {
return p1 * p2;
}
let result = myFunction(4, 3);
document.getElementById("demo").innerHTML = result;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
myFunction()
new
ﺖﯾﻮﻟﻭﺍ: 17
ﺖﻨﻣﻮﮔﺭﺁ ﺎﺑ ﺪﯾﺪﺟ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript new Date()</h1>
<p>A Date object can be created with a specified date and time:</p>
<p id="demo"></p>
<script>
const d = new Date("June 5, 2022");
document.getElementById("demo").innerHTML = d;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
new Date("June 5,2022")
new
ﺖﯾﻮﻟﻭﺍ: 16
ﻝﻻﺪﺘﺳﺍ ﻥﻭﺪﺑ ﺪﯾﺪﺟ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Dates</h1>
<h2>Using new Date()</h2>
<p>new Date() without arguments, creates a date object with the current date and time:</p>
<p id="demo"></p>
<script>
const d = new Date();
document.getElementById("demo").innerHTML = d;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
new Date()
ﺩﻮﺷ ﯽﻣ ﺍﺮﺟﺍ ﺪﻧﻮﺸﯿﭘ ﺶﯾﺍﺰﻓﺍ ﺯﺍ ﻞﺒﻗ ﺪﻧﻮﺴﭘ ﺶﯾﺍﺰﻓﺍ
++
ﺖﯾﻮﻟﻭﺍ: 15
ﺪﻧﻮﺴﭘ ﺶﯾﺍﺰﻓﺍ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<p>In this example, y is incremented after it is assigned to x (post-incremented).</p>
<p id="demo1"></p>
<p id="demo2"></p>
<script>
var y = 5;
var x = y++;
document.getElementById("demo1").innerHTML = y;
document.getElementById("demo2").innerHTML = x;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
i++
--
ﺖﯾﻮﻟﻭﺍ: 15
ﺪﻧﻮﺴﭘ ﺶﻫﺎﮐ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<p>In this example, y is decremented after it is assigned to x (post-decremented).</p>
<p id="demo1"></p>
<p id="demo2"></p>
<script>
var y = 5;
var x = y--;
document.getElementById("demo1").innerHTML = y;
document.getElementById("demo2").innerHTML = x;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
i--
++
ﺖﯾﻮﻟﻭﺍ: 14
ﺶﯾﺍﺰﻓﺍ ﺪﻧﻮﺸﯿﭘ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<p>In this example, y is incremented before it is assigned to x (pre-incremented).</p>
<p id="demo1"></p>
<p id="demo2"></p>
<script>
var y = 5;
var x = ++y;
document.getElementById("demo1").innerHTML = y;
document.getElementById("demo2").innerHTML = x;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
++i
--
ﺖﯾﻮﻟﻭﺍ: 14
ﺪﻧﻮﺸﯿﭘ ﺶﻫﺎﮐ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<p>In this example, y is decremented before it is assigned to x (pre-decremented).</p>
<p id="demo1"></p>
<p id="demo2"></p>
<script>
var y = 5;
var x = --y;
document.getElementById("demo1").innerHTML = y;
document.getElementById("demo2").innerHTML = x;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
--i
!
ﺖﯾﻮﻟﻭﺍ: 14
ﻪﻧ ﯽﻘﻄﻨﻣ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>The ! Operator</h2>
<p id="demo1"></p>
<p id="demo2"></p>
<script>
document.getElementById("demo1").innerHTML = (5 == 8);
document.getElementById("demo2").innerHTML = !(5 == 8);
</script>
</body>
</html>
: ﻝﺎﺜﻣ
!(x==y)
~
ﺖﯾﻮﻟﻭﺍ: 14
ﻪﻧ ﯽﺘﯿﺑ ﺕﺭﻮﺻ ﻪﺑ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Bitwise NOT</h1>
<h2>The ~ Operator</h2>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = ~ 5;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
~x
+
ﺖﯾﻮﻟﻭﺍ: 14
Unary Plus
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>Unary Plus</h2>
<p id="demo"></p>
<script>
let x = 5;
document.getElementById("demo").innerHTML = +x;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
+x
-
ﺖﯾﻮﻟﻭﺍ: 14
Unary Minus
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>Unary Minus</h2>
<p id="demo"></p>
<script>
let x = 5;
document.getElementById("demo").innerHTML = -x;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
-x
typeof
ﺖﯾﻮﻟﻭﺍ: 14
ﻩﺩﺍﺩ ﻉﻮﻧ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>The typeof Operator</h2>
<p>The typeof operator returns the type of a variable, object, function or expression:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"'John' is " + typeof "John" + "<br>" +
"3.14 is " + typeof 3.14 + "<br>" +
"NaN is " + typeof NaN + "<br>" +
"false is " + typeof false + "<br>" +
"[1, 2, 3, 4] is " + typeof [1, 2, 3, 4] + "<br>" +
"{name:'John', age:34} is " + typeof {name:'John', age:34} + "<br>" +
"new Date() is " + typeof new Date() + "<br>" +
"function () {} is " + typeof function () {} + "<br>" +
"myCar is " + typeof myCar + "<br>" +
"null is " + typeof null;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
typeof x
void
ﺖﯾﻮﻟﻭﺍ: 14
Void ﺪﯿﻨﮐ ﯽﺑﺎﯾﺯﺭﺍ ﺍﺭ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>The void Operator</h2>
<p>
<a href="javascript:void(0);">Useless link</a>
</p>
<p>
<a href="javascript:void(document.body.style.backgroundColor='red');">
Click me to change the background color of body to red.</a>
</p>
</body>
</html>
: ﻝﺎﺜﻣ
void(0)
delete
ﺖﯾﻮﻟﻭﺍ: 14
ﻝﺍﻮﻣﺍ ﻑﺬﺣ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>The delete Operator</h2>
<p>After deleting the color property, myCar.color is:</p>
<p id="demo"></p>
<script>
const myCar = {type:"Fiat", model:"500", color:"white"};
delete myCar.color;
document.getElementById("demo").innerHTML = myCar.color;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
delete myCar.color
ﺪﻧﻮﺷ ﯽﻣ ﺍﺮﺟﺍ ﺏﺮﺿ ﺯﺍ ﻞﺒﻗ ﺎﻫ ﻥﺍﻮﺗ
ﺩﻮﺷ ﯽﻣ ﻡﺎﺠﻧﺍ ﻖﯾﺮﻔﺗ ﻭ ﻊﻤﺟ ﺯﺍ ﻞﺒﻗ ﻢﯿﺴﻘﺗ ﻭ ﺏﺮﺿ
**
ﺖﯾﻮﻟﻭﺍ: 13
ﯼﺪﻨﻤﻧﺍﻮﺗ
<!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>
: ﻝﺎﺜﻣ
10 ** 2
*
ﺖﯾﻮﻟﻭﺍ: 12
ﺏﺮﺿ
<!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>
: ﻝﺎﺜﻣ
10 * 5
/
ﺖﯾﻮﻟﻭﺍ: 12
ﺶﺨﺑ
<!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>
: ﻝﺎﺜﻣ
10 / 5
%
ﺖﯾﻮﻟﻭﺍ: 12
ﻩﺪﻧﺎﻣ ﯽﻗﺎﺑ ﺶﺨﺑ
<!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>
: ﻝﺎﺜﻣ
10 % 5
+
ﺖﯾﻮﻟﻭﺍ: 11
ﻥﺪﺷ ﻪﻓﺎﺿﺍ
<!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>
: ﻝﺎﺜﻣ
10 + 5
-
ﺖﯾﻮﻟﻭﺍ: 11
ﻥﺩﺮﮐ ﺎﻬﻨﻣ
<!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>
: ﻝﺎﺜﻣ
10 - 5
+
ﺖﯾﻮﻟﻭﺍ: 11
ﻕﺎﺤﻟﺍ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript String Operators</h1>
<h2>The + Operator</h2>
<p>The + operator concatenates (adds) strings.</p>
<p id="demo"></p>
<script>
let text1 = "John";
let text2 = "Doe";
let text3 = text1 + " " + text2;
document.getElementById("demo").innerHTML = text3;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
"John" + "Doe"
<<
ﺖﯾﻮﻟﻭﺍ: 10
ﭗﭼ ﺖﻤﺳ ﺮﯿﯿﻐﺗ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Bitwise Left</h1>
<h2>The << Operator</h2>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 5 << 1;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x << 2
>>
ﺖﯾﻮﻟﻭﺍ: 10
Shift Right (ﺎﻀﻣﺍ)
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Signed Bitwise Right</h1>
<h2>The >> Operator</h2>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = -5 >> 1;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x >> 2
>>>
ﺖﯾﻮﻟﻭﺍ: 10
Shift Right (ﺎﻀﻣﺍ ﻥﻭﺪﺑ)
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Unsigned Bitwise Right</h1>
<h2>The >>> Operator</h2>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 5 >>> 1;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x >>> 2
in
ﺖﯾﻮﻟﻭﺍ: 9
ﯽﺷ ﺭﺩ ﺖﯿﺻﺎﺧ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>The in Operator</h2>
<p>Is "PI" a property of Math?</p>
<p id="demo"></p>
<script>
// Create an object:
document.getElementById("demo").innerHTML = "PI" in Math;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
"PI" in Math
instanceof
ﺖﯾﻮﻟﻭﺍ: 9
ﯽﺷ ﻪﻧﻮﻤﻧ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>The instanceof Operator</h2>
<p>The instanceof operator returns true if an object is an instance of a specified object:</p>
<p id="demo"></p>
<script>
const cars = ["Saab", "Volvo", "BMW"];
document.getElementById("demo").innerHTML =
(cars instanceof Array) + "<br>" +
(cars instanceof Object) + "<br>" +
(cars instanceof String) + "<br>" +
(cars instanceof Number);
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x instanceof Array
<
ﺖﯾﻮﻟﻭﺍ: 9
ﺯﺍ ﺮﺘﻤﮐ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Comparison</h1>
<h2>The < Operator</h2>
<p>Assign 5 to x, and display the value of the comparison (x < 8).</p>
<p id="demo"></p>
<script>
let x = 5;
document.getElementById("demo").innerHTML = (x < 8);
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x < y
<=
ﺖﯾﻮﻟﻭﺍ: 9
ﯼﻭﺎﺴﻣ ﺎﯾ ﺮﺘﻤﮐ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Comparison</h1>
<h2>The <= Operator</h2>
<p>Assign 5 to x, and display the value of the comparison (x <= 8).</p>
<p id="demo"></p>
<script>
let x = 5;
document.getElementById("demo").innerHTML = (x <= 8);
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x <= y
>
ﺖﯾﻮﻟﻭﺍ: 9
ﺯﺍ ﺮﺘﮔﺭﺰﺑ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Comparison</h1>
<h2>The > Operator</h2>
<p>Assign 5 to x, and display the value of the comparison (x > 8).</p>
<p id="demo"></p>
<script>
let x = 5;
document.getElementById("demo").innerHTML = (x > 8);
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x > y
>=
ﺖﯾﻮﻟﻭﺍ: 9
ﯼﻭﺎﺴﻣ ﺎﯾ ﺮﺘﮔﺭﺰﺑ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Comparison</h1>
<h2>The >= Operator</h2>
<p>Assign 5 to x, and display the value of the comparison (x >= 8).</p>
<p id="demo"></p>
<script>
let x = 5;
document.getElementById("demo").innerHTML = (x >= 8);
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x >= Array
==
ﺖﯾﻮﻟﻭﺍ: 8
ﺮﺑﺍﺮﺑ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Comparison</h1>
<h2>The == Operator</h2>
<p>Assign 5 to x, and display the value of the comparison (x == 8):</p>
<p id="demo"></p>
<script>
let x = 5;
document.getElementById("demo").innerHTML = (x == 8);
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x == y
===
ﺖﯾﻮﻟﻭﺍ: 8
ﺮﺑﺍﺮﺑ ﻖﯿﻗﺩ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Comparison</h1>
<h2>The === Operator</h2>
<p>Assign 5 to x, and display the value of the comparison (x === 5):</p>
<p id="demo"></p>
<script>
let x = 5;
document.getElementById("demo").innerHTML = (x === 5);
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x === y
!=
ﺖﯾﻮﻟﻭﺍ: 8
ﺮﺑﺍﺮﺑﺎﻧ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Comparison</h1>
<h2>The != Operator</h2>
<p>Assign 5 to x, and display the value of the comparison (x != 8).</p>
<p id="demo"></p>
<script>
let x = 5;
document.getElementById("demo").innerHTML = (x != 8);
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x != y
!==
ﺖﯾﻮﻟﻭﺍ: 8
ﺮﺑﺍﺮﺑﺎﻧ ﺖﺨﺳ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Comparison</h1>
<h2>The !== Operator</h2>
<p>Assign 5 to x, and display the value of the comparison (x !== "5"):</p>
<p id="demo"></p>
<script>
let x = 5;
document.getElementById("demo").innerHTML = (x !== "5");
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x !== y
&
ﺖﯾﻮﻟﻭﺍ: 7
ﻭ ﯽﺘﯿﺑ ﺕﺭﻮﺻ ﻪﺑ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Bitwise AND</h1>
<h2>The & Operator</h2>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 5 & 1;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x & y
^
ﺖﯾﻮﻟﻭﺍ: 6
XOR ﯽﺘﯿﺑ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Bitwise XOR</h1>
<h2>The ^ Operator</h2>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 5 ^ 1;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x ^ y
|
ﺖﯾﻮﻟﻭﺍ: 5
OR ﯽﺘﯿﺑ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Bitwise OR</h1>
<h2>The | Operator</h2>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 5 | 1;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x | y
&&
ﺖﯾﻮﻟﻭﺍ: 4
ﻭ ﯽﻘﻄﻨﻣ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Comparison</h1>
<h2>The && Operator (Logical AND)</h2>
<p>The && operator returns true if both expressions are true, otherwise it returns false.</p>
<p id="demo"></p>
<script>
let x = 6;
let y = 3;
document.getElementById("demo").innerHTML =
(x < 10 && y > 1) + "<br>" +
(x < 10 && y < 1);
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x && y
||
ﺖﯾﻮﻟﻭﺍ: 3
OR ﯽﻘﻄﻨﻣ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Comparison</h1>
<h2>The || Operator (Logical OR)</h2>
<p>The || returns true if one or both expressions are true, otherwise it returns false.</p>
<p id="demo"></p>
<script>
let x = 6;
let y = 3;
document.getElementById("demo").innerHTML =
(x == 5 || y == 5) + "<br>" +
(x == 6 || y == 0) + "<br>" +
(x == 0 || y == 3) + "<br>" +
(x == 6 || y == 3);
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x || y
??
ﺖﯾﻮﻟﻭﺍ: 3
ﻞﻃﺎﺑ ﻡﺎﻏﺩﺍ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>The ?? Operator</h2>
<p>The ?? operator returns the first argument if it is not nullish (null or undefined). Otherwise it returns the second.</p>
<p id="demo"></p>
<script>
let name = null;
let text = "missing";
let result = name ?? text;
document.getElementById("demo").innerHTML = "The name is " + result;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x ?? y
? :
ﺖﯾﻮﻟﻭﺍ: 2
ﺖﯿﻌﺿﻭ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Comparison</h1>
<h2>The () ? : Ternary Operator</h2>
<p>Input your age and click the button:</p>
<input id="age" value="18" />
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
let age = document.getElementById("age").value;
let voteable = (age < 18) ? "Too young":"Old enough";
document.getElementById("demo").innerHTML = voteable + " to vote.";
}
</script>
</body>
</html>
: ﻝﺎﺜﻣ
? "yes" : "no"
ﺪﻧﻮﺷ ﯽﻣ ﺍﺮﺟﺍ ﺮﮕﯾﺩ ﺕﺎﯿﻠﻤﻋ ﺯﺍ ﺲﭘ ﻒﯿﻟﺎﮑﺗ
=
ﺖﯾﻮﻟﻭﺍ: 2
ﻩﺩﺎﺳ ﻒﯿﻠﮑﺗ
<!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>
: ﻝﺎﺜﻣ
x = y
:
ﺖﯾﻮﻟﻭﺍ: 2
ﻥﻮﻟﻮﮐ ﻦﯿﯿﻌﺗ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Objects</h1>
<h2>The : Operator</h2>
<p id="demo"></p>
<script>
const size = {x: 5, y: 10, z: 1};
document.getElementById("demo").innerHTML = "The width is " + size.x;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x: 5
+=
ﺖﯾﻮﻟﻭﺍ: 2
ﻪﻓﺎﺿﺍ ﻒﯿﻠﮑﺗ
<!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>
: ﻝﺎﺜﻣ
x += y
-=
ﺖﯾﻮﻟﻭﺍ: 2
ﻖﯾﺮﻔﺗ ﺺﯿﺼﺨﺗ
<!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>
: ﻝﺎﺜﻣ
x -= y
*=
ﺖﯾﻮﻟﻭﺍ: 2
ﺏﺮﺿ ﻒﯿﻠﮑﺗ
<!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>
: ﻝﺎﺜﻣ
x *= y
**=
ﺖﯾﻮﻟﻭﺍ: 2
ﻥﺍﻮﺗ ﺺﯿﺼﺨﺗ
<!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>
: ﻝﺎﺜﻣ
x **= y
/=
ﺖﯾﻮﻟﻭﺍ: 2
ﺶﺨﺑ ﻒﯿﻠﮑﺗ
<!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>
: ﻝﺎﺜﻣ
x /= y
%=
ﺖﯾﻮﻟﻭﺍ: 2
ﻩﺪﻧﺎﻣ ﯽﻗﺎﺑ ﻒﯿﻠﮑﺗ
<!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>
: ﻝﺎﺜﻣ
x %= y
<<=
ﺖﯾﻮﻟﻭﺍ: 2
ﭗﭼ ﺖﻔﯿﺷ ﯼﺭﺍﺬﮔﺍﻭ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Assignments</h1>
<h2>Left Shift 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>
: ﻝﺎﺜﻣ
x <<= y
>>=
ﺖﯾﻮﻟﻭﺍ: 2
ﺖﺳﺍﺭ ﺖﻔﯿﺷ ﺺﯿﺼﺨﺗ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Assignments</h1>
<h2>Right Shift 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>
: ﻝﺎﺜﻣ
x >>= y
>>>=
ﺖﯾﻮﻟﻭﺍ: 2
Shift ﺖﺳﺍﺭ ﻪﺑ ﺖﻣﻼﻋ ﻥﻭﺪﺑ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Assignments</h1>
<h2>Right Shift 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>
: ﻝﺎﺜﻣ
x >>>= y
&=
ﺖﯾﻮﻟﻭﺍ: 2
Bitwise AND Assignment
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Assignments</h1>
<h2>Bitwise AND 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>
: ﻝﺎﺜﻣ
x &= y
|=
ﺖﯾﻮﻟﻭﺍ: 2
Bitwise OR Assignment
<!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>
: ﻝﺎﺜﻣ
x |= y
^=
ﺖﯾﻮﻟﻭﺍ: 2
XOR ﯽﺘﯿﺑ ﺺﯿﺼﺨﺗ
<!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>
: ﻝﺎﺜﻣ
x ^= y
&&=
ﺖﯾﻮﻟﻭﺍ: 2
ﻒﯿﻠﮑﺗ ﻭ ﯽﻘﻄﻨﻣ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Assignments</h1>
<h2>Logical AND 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>
: ﻝﺎﺜﻣ
x &&= y
||=
ﺖﯾﻮﻟﻭﺍ: 2
ﻒﯿﻠﮑﺗ ﺎﯾ ﯽﻘﻄﻨﻣ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Assignments</h1>
<h2>Logical OR Assignment</h2>
<h3>The ||= Operator</h3>
<p id="demo"></p>
<script>
let x = 100;
x ||= 4;
document.getElementById("demo").innerHTML = "Value of x is: " + x;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x ||= y
=>
ﺖﯾﻮﻟﻭﺍ: 2
ﺶﻠﻓ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Functions</h1>
<h2>The Arrow Function</h2>
<p>This example shows an Arrow Function with a parameter.</p>
<p id="demo"></p>
<script>
let hello = "";
hello = (val) => "Hello " + val;
document.getElementById("demo").innerHTML = hello("Universe!");
</script>
</body>
</html>
: ﻝﺎﺜﻣ
x => y
yield
ﺖﯾﻮﻟﻭﺍ: 2
ﯼﺮﯿﮔﺮﺳ ﺯﺍ/ﺚﮑﻣ
: ﻝﺎﺜﻣ
yield x
yield*
ﺖﯾﻮﻟﻭﺍ: 2
ﻩﺪﻨﯾﺎﻤﻧ
: ﻝﺎﺜﻣ
yield* x
...
ﺖﯾﻮﻟﻭﺍ: 2
ﺵﺮﺘﺴﮔ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Operators</h1>
<h2>The ... Operator</h2>
<p>The "Spread" operator can be used to expand an iterable into more arguments for function calls:</p>
<p id="demo"></p>
<script>
const numbers = [23,55,21,87,56];
let maxValue = Math.max(...numbers);
document.getElementById("demo").innerHTML = maxValue;
</script>
</body>
</html>
: ﻝﺎﺜﻣ
... x
,
ﺖﯾﻮﻟﻭﺍ: 1
ﺎﻣﺎﮐ
: ﻝﺎﺜﻣ
x , y