ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫ ﻪﯿﻧﺎﯿﺑ


فهرست مطالب

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


ﻝﺎﺜﻣ

let x, y, z;    // Statement 1
x = 5;          // Statement 2
y = 6;          // Statement 3
z = x + y;      //  Statement 4

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Statements</h2>

<p>A <b>JavaScript program</b> is a list of <b>statements</b> to be executed by a computer.</p>

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

<script>
let x, y, z;  // Statement 1
x = 5;        // Statement 2
y = 6;        // Statement 3
z = x + y;    // Statement 4

document.getElementById("demo").innerHTML =
"The value of z is " + z + ".";  
</script>

</body>
</html>

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫ ﻪﻣﺎﻧﺮﺑ

ﯼﺍ ﻪﻧﺎﯾﺍﺭ ﻪﻣﺎﻧﺮﺑ ﺖﺳﺍ "ﻞﻤﻌﻟﺍﺭﻮﺘﺳﺩ" ﺯﺍ ﯽﺘﺳﺮﻬﻓ

.ﺪﻧﻮﺷ ﯽﻣ ﻩﺪﯿﻣﺎﻧ ﻩﺭﺍﺰﮔ ﯽﺴﯾﻮﻧ ﻪﻣﺎﻧﺮﺑ ﯼﺎﻫ ﻞﻤﻌﻟﺍﺭﻮﺘﺳﺩ ﻦﯾﺍ ،ﯽﺴﯾﻮﻧ ﻪﻣﺎﻧﺮﺑ ﻥﺎﺑﺯ ﮏﯾ ﺭﺩ

.ﺖﺳﺍ ﯽﺴﯾﻮﻧ ﻪﻣﺎﻧﺮﺑ ﯼﺎﻫ ﻩﺭﺍﺰﮔ ﺯﺍ ﯽﺘﺴﯿﻟ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﻣﺎﻧﺮﺑ ﮏﯾ

.ﺪﻧﻮﺷ ﯽﻣ ﺍﺮﺟﺍ ﺏﻭ ﺮﮔﺭﻭﺮﻣ ﻂﺳﻮﺗ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫ ﻪﻣﺎﻧﺮﺑ ،HTML ﺭﺩ


ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫ ﻪﯿﻧﺎﯿﺑ

:ﺖﺳﺍ ﻩﺪﺷ ﻞﯿﮑﺸﺗ ﺮﯾﺯ ﺩﺭﺍﻮﻣ ﺯﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺕﺍﺭﺎﺒﻋ

،ﯼﺪﯿﻠﮐ ﺕﺎﻤﻠﮐ ،ﺕﺍﺭﺎﺒﻋ ،ﺎﻫﺭﻮﺗﺍﺮﭘﺍ ،ﺮﯾﺩﺎﻘﻣ

.ﺪﺴﯾﻮﻨﺑ ﺍﺭ «ﯽﻟﺍﺩ ﻡﻼﺳ» ﺪﯾﻮﮔﯽﻣ ﺮﮔﺭﻭﺮﻣ ﻪﺑ ﺕﺭﺎﺒﻋ ﻦﯾﺍ

ﻝﺎﺜﻣ

document.getElementById("demo").innerHTML = "Hello Dolly.";

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Statements</h2>

<p>In HTML, JavaScript statements are executed by the browser.</p>

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

<script>
document.getElementById("demo").innerHTML = "Hello Dolly.";
</script>

</body>
</html>

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺮﺜﮐﺍ

ﺭﺩ ،ﯽﮑﯾ ﯽﮑﯾ ،ﺕﺍﺭﺎﺒﻋ

.ﺪﻧﻮﺷ ﯽﻣ ﻩﺪﯿﻣﺎﻧ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺪﮐ ﺐﻠﻏﺍ (ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺕﺍﺭﺎﺒﻋ ﻭ) ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫ ﻪﻣﺎﻧﺮﺑ


; ﻝﻮﮔﺮﯾﻭ ﻪﻄﻘﻧ

.ﺪﻨﻨﮐ ﯽﻣ ﺍﺪﺟ ﺍﺭ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺕﺍﺭﺎﺒﻋ ﺎﻫ ﻝﻮﮔﺮﯾﻭ ﻪﻄﻘﻧ

:ﺪﯿﻨﮐ ﻪﻓﺎﺿﺍ ﻝﻮﮔﺮﯾﻭ ﻪﻄﻘﻧ ﮏﯾ ﯽﯾﺍﺮﺟﺍ ﺭﻮﺘﺳﺩ ﺮﻫ ﻥﺎﯾﺎﭘ ﺭﺩ

ﺎﻫ ﻝﺎﺜﻣ

let a, b, c;  // Declare 3 variables
a = 5;        // Assign the value 5 to a
b = 6;        // Assign the value 6 to b
c = a + b;    // Assign the sum of a and b to c

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Statements</h2>

<p>JavaScript statements are separated by semicolons.</p>

<p id="demo1"></p>

<script>
let a, b, c;
a = 5;
b = 6;
c = a + b;
document.getElementById("demo1").innerHTML = c;
</script>

</body>
</html>

:ﺖﺳﺍ ﺯﺎﺠﻣ ﻂﺧ ﮏﯾ ﺭﺩ ﺭﻮﺘﺳﺩ ﻦﯾﺪﻨﭼ ،ﺪﻧﻮﺷ ﯽﻣ ﺍﺪﺟ ﻢﻫ ﺯﺍ ﻝﻮﮔﺮﯾﻭ ﻪﻄﻘﻧ ﺎﺑ ﯽﺘﻗﻭ

a = 5; b = 6; c = a + b;

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Statements</h2>

<p>Multiple statements on one line are allowed.</p>

<p id="demo1"></p>

<script>
let a, b, c;
a = 5; b = 6; c = a + b;
document.getElementById("demo1").innerHTML = c;
</script>

</body>
</html>


.ﺪﯿﻨﯿﺒﺑ ﻝﻮﮔﺮﯾﻭ ﻪﻄﻘﻧ ﻥﻭﺪﺑ ﺍﺭ ﯽﯾﺎﻫ ﻪﻧﻮﻤﻧ ﺖﺳﺍ ﻦﮑﻤﻣ ،ﺏﻭ ﺭﺩ



ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺪﯿﻔﺳ ﯼﺎﻀﻓ

.ﺩﻮﺷ ﺮﺗﺎﻧﺍﻮﺧ ﺎﺗ ﺪﯿﻨﮐ ﻪﻓﺎﺿﺍ ﺩﻮﺧ ﺖﭙﯾﺮﮑﺳﺍ ﻪﺑ ﺍﺭ ﯽﻟﺎﺧ ﯼﺎﻀﻓ ﺪﯿﻧﺍﻮﺗ ﯽﻣ .ﺩﺮﯿﮔ ﯽﻣ ﻩﺪﯾﺩﺎﻧ ﺍﺭ ﻪﻠﺻﺎﻓ ﻦﯾﺪﻨﭼ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

:ﺪﻨﺘﺴﻫ ﻝﺩﺎﻌﻣ ﺮﯾﺯ ﻁﻮﻄﺧ

let person = "Hege";
let person="Hege";

:(/* - +=) ﺎﻫﺮﮕﻠﻤﻋ ﻑﺍﺮﻃﺍ ﯼﺎﻫﺎﻀﻓ ﻪﮐ ﺖﺳﺍ ﻦﯾﺍ ﺏﻮﺧ ﻦﯾﺮﻤﺗ ﮏﯾ

let x = y + z;

ﻂﺧ ﺖﺴﮑﺷ ﻭ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻂﺧ ﻝﻮﻃ

ﺪﻨﻨﮐ ﺏﺎﻨﺘﺟﺍ 80 ﺯﺍ ﺮﺗ ﯽﻧﻻﻮﻃ ﺪﮐ ﻁﻮﻄﺧ ﺯﺍ ﺪﻧﺭﺍﺩ ﺖﺳﻭﺩ ﺐﻠﻏﺍ ﻥﺎﺴﯾﻮﻧ ﻪﻣﺎﻧﺮﺑ ،ﯽﯾﺎﻧﺍﻮﺧ ﻦﯾﺮﺘﻬﺑ ﯼﺍﺮﺑ

ﺖﺳﺍ ﻦﺘﺴﮑﺷ ﯼﺍﺮﺑ ﻥﺎﮑﻣ ﻦﯾﺮﺘﻬﺑ ،ﺩﺮﯿﮕﻧ ﺭﺍﺮﻗ ﻂﺧ ﮏﯾ ﺭﺩ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﻮﺘﺳﺩ ﺮﮔﺍ

ﻝﺎﺜﻣ

document.getElementById("demo").innerHTML =
"Hello Dolly!";

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Statements</h2>

<p>
The best place to break a code line is after an operator or a comma.
</p>

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

<script>
document.getElementById("demo").innerHTML =
"Hello Dolly!";
</script>

</body>
</html>

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺪﮐ ﯼﺎﻫ ﮎﻮﻠﺑ

ﺩﺮﮐ ﯼﺪﻨﺑ ﻩﻭﺮﮔ curly ﻞﺧﺍﺩ ،ﺪﮐ ﯼﺎﻫ ﮎﻮﻠﺑ ﺭﺩ ﻢﻫ ﺎﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺕﺍﺭﺎﺒﻋ

.ﺪﻧﻮﺷ ﺍﺮﺟﺍ ﻢﻫ ﺎﺑ ﺪﯾﺎﺑ ﻪﮐ ﺖﺳﺍ ﯽﺗﺍﺭﺎﺒﻋ ﻒﯾﺮﻌﺗ ﺪﮐ ﯼﺎﻫ ﮎﻮﻠﺑ ﺯﺍ ﻑﺪﻫ

ﺖﺳﺍ ﻥﺁ ﺭﺩ ،ﺪﻧﺍﻩﺪﺷ ﯼﺪﻨﺑﻩﻭﺮﮔ ﺎﻫﮎﻮﻠﺑ ﺭﺩ ﻪﮐ ﺪﯿﻨﯿﺑﯽﻣ ﺍﺭ ﯽﺗﺍﺭﺎﺒﻋ ﻪﮐ ﯽﯾﺎﺟ

ﻝﺎﺜﻣ

function myFunction() {
  document.getElementById("demo1").innerHTML = "Hello Dolly!";
  document.getElementById("demo2").innerHTML = "How are you?";
}

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Statements</h2>

<p>JavaScript code blocks are written between { and }</p>

<button type="button" onclick="myFunction()">Click Me!</button>

<p id="demo1"></p>
<p id="demo2"></p>

<script>
function myFunction() {
  document.getElementById("demo1").innerHTML = "Hello Dolly!";
  document.getElementById("demo2").innerHTML = "How are you?";
}
</script>

</body>
</html>


.ﻢﯿﻨﮐ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﺪﮐ ﯼﺎﻫ ﮎﻮﻠﺑ ﯼﺍﺮﺑ ﯽﮕﺘﻓﺭﻮﺗ ﻪﻠﺻﺎﻓ 2 ﺯﺍ ﺎﻣ ﺵﺯﻮﻣﺁ ﻦﯾﺍ ﺭﺩ


ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺪﯿﻠﮐ ﺕﺎﻤﻠﮐ

ﺩﻮﺷ ﯽﻣ ﻉﻭﺮﺷ ﯼﺪﯿﻠﮐ ﻪﻤﻠﮐ ﺎﺑ ﺐﻠﻏﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺕﺍﺭﺎﺒﻋ

Reserved Words Reference ﺪﻨﮐ ﯽﻣ ﺖﺳﺮﻬﻓ ﺍﺭ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺪﯿﻠﮐ ﺕﺎﻤﻠﮐ ﻪﻤﻫ ﺎﻣ.

ﺖﻓﺮﮔ ﺪﯿﻫﺍﻮﺧ ﺩﺎﯾ ﺎﻬﻧﺁ ﺩﺭﻮﻣ ﺭﺩ ﻪﮐ ﺖﺳﺍ ﯼﺪﯿﻠﮐ ﺕﺎﻤﻠﮐ ﺯﺍ ﯽﺧﺮﺑ ﺯﺍ ﯽﺘﺴﯿﻟ ﺎﺠﻨﯾﺍ ﺭﺩ

var

ﺪﻨﮐ ﯽﻣ ﻡﻼﻋﺍ ﺍﺭ ﺮﯿﻐﺘﻣ ﮏﯾ

let

ﺪﻨﮐ ﯽﻣ ﻡﻼﻋﺍ ﺍﺭ ﯽﮐﻮﻠﺑ ﺮﯿﻐﺘﻣ ﮏﯾ

const

ﺪﻨﮐ ﯽﻣ ﻡﻼﻋﺍ ﺖﺑﺎﺛ ﺍﺭ ﮎﻮﻠﺑ ﮏﯾ

if

ﺪﻨﮐ ﯽﻣ ﯼﺭﺍﺬﮔ ﺖﻣﻼﻋ ﻁﺮﺷ ﮏﯾ ﺭﺩ ﺍﺮﺟﺍ ﯼﺍﺮﺑ ﺍﺭ ﺕﺍﺭﻮﺘﺳﺩ ﺯﺍ ﯽﮐﻮﻠﺑ

switch

ﺪﻨﮐ ﯽﻣ ﯼﺭﺍﺬﮔ ﺖﻣﻼﻋ ﻒﻠﺘﺨﻣ ﺩﺭﺍﻮﻣ ﺭﺩ ﺍﺮﺟﺍ ﯼﺍﺮﺑ ﺍﺭ ﺕﺍﺭﻮﺘﺳﺩ ﺯﺍ ﯽﮐﻮﻠﺑ

for

ﺪﻨﮐ ﯽﻣ ﯼﺭﺍﺬﮔ ﺖﻣﻼﻋ ﻪﻘﻠﺣ ﮏﯾ ﺭﺩ ﺍﺮﺟﺍ ﯼﺍﺮﺑ ﺍﺭ ﺕﺍﺭﻮﺘﺳﺩ ﺯﺍ ﯽﮐﻮﻠﺑ

function

ﺪﻨﮐ ﯽﻣ ﻡﻼﻋﺍ ﺍﺭ ﻊﺑﺎﺗ ﮏﯾ

return

ﺩﻮﺷ ﯽﻣ ﺝﺭﺎﺧ ﻊﺑﺎﺗ ﮏﯾ ﺯﺍ

try

ﺪﻨﮐ ﯽﻣ ﯼﺯﺎﺳ ﻩﺩﺎﯿﭘ ﺕﺍﺭﺎﺒﻋ ﺯﺍ ﯽﮐﻮﻠﺑ ﺭﺩ ﺍﺭ ﺎﻄﺧ ﺖﯾﺮﯾﺪﻣ

.ﺩﺮﮐ ﻩﺩﺎﻔﺘﺳﺍ ﺎﻫﺮﯿﻐﺘﻣ ﻡﺎﻧ ﻥﺍﻮﻨﻋ ﻪﺑ ﻥﺍﻮﺗ ﯽﻤﻧ ﺍﺭ ﻩﺪﺷ ﻭﺭﺯﺭ ﺕﺎﻤﻠﮐ .ﺪﻨﺘﺴﻫ ﻩﺪﺷ ﻭﺭﺯﺭ ﺕﺎﻤﻠﮐ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺪﯿﻠﮐ ﺕﺎﻤﻠﮐ

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