ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻮﺤﻧ


فهرست مطالب

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

ﺖﺳﺍ ﻪﻧﻮﮕﭼ ﻪﮐ ﺖﺳﺍ ﻦﯿﻧﺍﻮﻗ ﺯﺍ ﯼﺍ ﻪﻋﻮﻤﺠﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻮﺤﻧ

// How to create variables:
var x;
let y;

// How to use variables:
x = 5;
y = 6;
let z = x + y;

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺮﯾﺩﺎﻘﻣ

:ﺪﻨﮐ ﯽﻣ ﻒﯾﺮﻌﺗ ﺍﺭ ﺭﺍﺪﻘﻣ ﻉﻮﻧ ﻭﺩ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻮﺤﻧ

  • ﺖﺑﺎﺛ ﺮﯾﺩﺎﻘﻣ

  • ﺮﯿﻐﺘﻣ ﺮﯾﺩﺎﻘﻣ

.ﺪﻧﻮﺷ ﯽﻣ ﻩﺪﯿﻣﺎﻧ Literals ﺖﺑﺎﺛ ﺮﯾﺩﺎﻘﻣ

.ﺪﻨﯾﻮﮔ ﯽﻣ ﺮﯿﻐﺘﻣ ﺮﯿﻐﺘﻣ ﺮﯾﺩﺎﻘﻣ ﻪﺑ


Literals ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

:ﺯﺍ ﺪﻨﺗﺭﺎﺒﻋ ﺖﺑﺎﺛ ﺮﯾﺩﺎﻘﻣ ﯼﺍﺮﺑ ﻢﻬﻣ ﯼﻮﺤﻧ ﻥﻮﻧﺎﻗ ﻭﺩ

1. ﺩﺍﺪﻋﺍ ﺪﻧﻮﺷ ﯽﻣ ﻪﺘﺷﻮﻧ ﺎﯾ ﺎﺑ

10.50

1001 

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Numbers</h2>

<p>Number can be written with or without decimals.</p>

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

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

</body>
</html>

2. ﻪﺘﺷﺭﺎﻫ ﻪﻣﻮﯿﮔ ﺭﺩ ﻪﮐ ﺪﻨﺘﺴﻫ ﯽﻨﺘﻣﯽﻣ ﻪﺘﺷﻮﻧ ﯽﮑﺗ ﺎﯾ ﯽﯾﺎﺗﻭﺩ ﯼﺎﻫﺪﻧﻮﺷ:

"John Doe"

'John Doe'

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Strings</h2>

<p>Strings can be written with double or single quotes.</p>

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

<script>
document.getElementById("demo").innerHTML = 'John Doe';
</script>

</body>
</html>


ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫﺮﯿﻐﺘﻣ

ﺎﻫﺮﯿﻐﺘﻣ ،ﯽﺴﯾﻮﻧ ﻪﻣﺎﻧﺮﺑ ﻥﺎﺑﺯ ﮏﯾ ﺭﺩ

،ﺪﻨﮐ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ var ﯼﺪﯿﻠﮐ ﺕﺎﻤﻠﮐ ﺯﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

.ﺩﻮﺷﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﺎﻫﺮﯿﻐﺘﻣ ﻪﺑ ﺮﯾﺩﺎﻘﻣ ﺺﯿﺼﺨﺗ ﯼﺍﺮﺑ ﯼﻭﺎﺴﻣ ﺖﻣﻼﻋ ﮏﯾ

ﺖﺳﺍ x ،ﺲﭙﺳ .ﺖﺳﺍ ﻩﺪﺷ ﻒﯾﺮﻌﺗ ﺮﯿﻐﺘﻣ ﮏﯾ ﻥﺍﻮﻨﻋ ﻪﺑ x ،ﻝﺎﺜﻣ ﻦﯾﺍ ﺭﺩ

let x;
x = 6; 

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Variables</h2>

<p>In this example, x is defined as a variable.
Then, x is assigned the value of 6:</p>

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

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

</body>
</html>

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

ﻪﺑ ( /*<" ﺪﻨﮐ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ "code class="w3-codespan">+

(5 + 6) * 10

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Operators</h2>

<p>JavaScript uses arithmetic operators to compute values (just like algebra).</p>

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

<script>
document.getElementById("demo").innerHTML = (5 + 6) * 10;
</script>

</body>
</html>

.ﺪﻨﮐ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﺺﯿﺼﺨﺗ ﯼﺍﺮﺑ ( = )/>ﺹﺎﺼﺘﺧﺍ ﺮﮕﻠﻤﻋ ﮏﯾ ﺯ

let x, y;
x = 5;
y = 6;

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

<!DOCTYPE html>
<html>
<body>

<h2>Assigning JavaScript Values</h2>

<p>In JavaScript the = operator is used to assign values to variables.</p>

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

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

</body>
</html>

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺕﺍﺭﺎﺒﻋ

.ﺖﺳﺍ ﺎﻫﺮﮕﻠﻤﻋ ﻭ ﺎﻫﺮﯿﻐﺘﻣ ،ﺮﯾﺩﺎﻘﻣ ﺯﺍ ﯽﺒﯿﮐﺮﺗ ﺕﺭﺎﺒﻋ ﮏﯾ

.ﺩﻮﺷ ﯽﻣ ﻩﺪﯿﻣﺎﻧ ﯽﺑﺎﯾﺯﺭﺍ ﺕﺎﺒﺳﺎﺤﻣ

:ﺩﻮﺷ ﯽﻣ ﯽﺑﺎﯾﺯﺭﺍ 50 ﻪﺑ 10 * 5 ،ﻝﺎﺜﻣ ﻥﺍﻮﻨﻋ ﻪﺑ

5 * 10 

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Expressions</h2>

<p>Expressions compute to values.</p>

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

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

</body>
</html>

:ﺪﻨﺷﺎﺑ ﺮﯿﻐﺘﻣ ﺮﯾﺩﺎﻘﻣ ﯼﻭﺎﺣ ﺪﻨﻧﺍﻮﺗ ﯽﻣ ﻦﯿﻨﭽﻤﻫ ﺕﺍﺭﺎﺒﻋ

 x * 10 

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Expressions</h2>

<p>Expressions compute to values.</p>

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

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

</body>
</html>

.ﺎﻫ ﻪﺘﺷﺭ ﻭ ﺩﺍﺪﻋﺍ ﺪﻨﻧﺎﻣ ،ﺪﻨﺷﺎﺑ ﻪﺘﺷﺍﺩ ﯽﻔﻠﺘﺨﻣ ﻉﺍﻮﻧﺍ ﺪﻨﻧﺍﻮﺗ ﯽﻣ ﺮﯾﺩﺎﻘﻣ

:ﺩﻮﺷ ﯽﻣ ﯽﺑﺎﯾﺯﺭﺍ "ﻭﺩ ﻥﺎﺟ" ﻪﺑ ،"ﻭﺩ" + "" + "ﻥﺎﺟ" ،ﻝﺎﺜﻣ ﻥﺍﻮﻨﻋ ﻪﺑ

 "John" + " " + "Doe"

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Expressions</h2>

<p>Expressions compute to values.</p>

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

<script>
document.getElementById("demo").innerHTML = "John" + " "  + "Doe";
</script>

</body>
</html>

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

ﺩﻮﺷ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﻩﮊﺍﻭ ﺪﯿﻠﮐ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

ﻦﯾﺍ

let x, y;
x = 5 + 6;
y = x * 10;

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

<!DOCTYPE html>
<html>
<body>

<h2>The <b>let</b> Keyword Creates Variables</h2>

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

<script>
let x, y;
x = 5 + 6;
y = x * 10;
document.getElementById("demo").innerHTML = y;
</script>

</body>
</html>

ﻦﯾﺍ

 var x, y;
x = 5 + 6;
y = x * 10;

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

<!DOCTYPE html>
<html>
<body>

<h2>The var Keyword Creates Variables</h2>

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

<script>
var x, y;
x = 5 + 6;
y = x * 10;
document.getElementById("demo").innerHTML = y;
</script>

</body>
</html>

var ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ ﺎﻫ ﻝﺎﺜﻣ ﻦﯾﺍ ﺭﺩ

ﺖﺧﻮﻣﺁ ﺪﯿﻫﺍﻮﺧ ﺮﺘﺸﯿﺑ var ﻩﺭﺎﺑﺭﺩ


ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺕﺍﺮﻈﻧ

.ﺪﻧﻮﺷ ﯽﻤﻧ "ﺍﺮﺟﺍ" ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺕﺍﺭﻮﺘﺳﺩ ﻪﻤﻫ

ﻞﺑﻭﺩ ﯼﺎﻫ ﺶﻠﺳﺍ ﺯﺍ ﺪﻌﺑ ﺪﮐ

ﺩﻮﺑ ﺪﻨﻫﺍﻮﺨﻧ ﻭ ﺪﻧﻮﺷ ﯽﻣ ﻪﺘﻓﺮﮔ ﻩﺪﯾﺩﺎﻧ ﺕﺍﺮﻈﻧ

let x = 5;   // I will be executed
// x = 6;   I will 
NOT be executed

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Comments are NOT Executed</h2>

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

<script>
let x;
x = 5;
// x = 6; I will not be executed
document.getElementById("demo").innerHTML = x;
</script>

</body>
</html>

.ﺖﺧﻮﻣﺁ ﺪﯿﻫﺍﻮﺧ ﺮﺘﺸﯿﺑ ﺕﺍﺮﻈﻧ ﻩﺭﺎﺑﺭﺩ ﺪﻌﺑ ﻞﺼﻓ ﺭﺩ


ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫ ﻡﺎﻧ/ﺎﻫ ﻪﺳﺎﻨﺷ

.ﺪﻨﺘﺴﻫ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻡﺎﻧ ﺎﻫ ﻪﺳﺎﻨﺷ

.ﺪﻧﻮﺷ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﻊﺑﺍﻮﺗ ﻭ ﯼﺪﯿﻠﮐ ﺕﺎﻤﻠﮐ ﻭ ﺎﻫﺮﯿﻐﺘﻣ ﯼﺭﺍﺬﮕﻣﺎﻧ ﯼﺍﺮﺑ ﺎﻫ ﻪﺳﺎﻨﺷ

.ﺖﺳﺍ ﻥﺎﺴﮑﯾ ﯽﺴﯾﻮﻧ ﻪﻣﺎﻧﺮﺑ ﯼﺎﻫ ﻥﺎﺑﺯ ﺮﺜﮐﺍ ﺭﺩ ﯽﻧﻮﻧﺎﻗ ﯼﺎﻫ ﻡﺎﻧ ﻦﯿﻧﺍﻮﻗ

:ﺎﺑ ﺪﯾﺎﺑ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻡﺎﻧ

  • (a-z ﺎﯾ A-Z) ﻑﺮﺣ ﮏﯾ

  • ($) ﺭﻻﺩ ﺖﻣﻼﻋ

  • (_) ﺮﯾﺯ ﻂﺧ ﺎﯾ

.ﺪﻨﺷﺎﺑ ﺭﻻﺩ ﺖﻣﻼﻋ ﺎﯾ ﻂﺧﺮﯾﺯ ،ﺩﺍﺪﻋﺍ ،ﻑﻭﺮﺣ ﺖﺳﺍ ﻦﮑﻤﻣ ﯼﺪﻌﺑ ﯼﺎﻫﺮﺘﮐﺍﺭﺎﮐ

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

.ﺪﻨﺘﺴﯿﻧ ﺯﺎﺠﻣ ﺎﻫ ﻡﺎﻧ ﺭﺩ ﺮﺘﮐﺍﺭﺎﮐ ﻦﯿﻟﻭﺍ ﻥﺍﻮﻨﻋ ﻪﺑ ﺩﺍﺪﻋﺍ

.ﺪﻫﺩ ﺺﯿﺨﺸﺗ ﺩﺍﺪﻋﺍ ﺯﺍ ﺍﺭ ﺎﻫ ﻪﺳﺎﻨﺷ ﯽﺘﺣﺍﺭ ﻪﺑ ﺪﻧﺍﻮﺗ ﯽﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺐﯿﺗﺮﺗ ﻦﯾﺍ ﻪﺑ


ﺖﺳﺍ ﺱﺎﺴﺣ ﮏﭼﻮﮐ ﻭ ﮒﺭﺰﺑ ﻑﻭﺮﺣ ﻪﺑ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

ﺪﻨﺘﺴﻫ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫ ﻪﺳﺎﻨﺷ ﻪﻤﻫ

،ﯽﮔﺩﺍﻮﻧﺎﺧ ﻡﺎﻧ<"code class="w3-codespan> ﻭ lastName ﯼﺎﻫﺮﯿﻐﺘﻣ

let lastname, lastName;
lastName = "Doe";
lastname = "Peterson";

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

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript is Case Sensitive</h2>

<p>Try to change lastName to lastname.</p>

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

<script>
let lastname, lastName;
lastName = "Doe";
lastname = "Peterson";
document.getElementById("demo").innerHTML = lastName;
</script>

</body>
</html>

.ﺪﻨﮐ ﯽﻤﻧ ﺮﯿﺴﻔﺗ let ﯼﺪﯿﻠﮐ ﻪﻤﻠﮐ ﻥﺍﻮﻨﻋ ﻪﺑ ﺍﺭ Let ﺎﯾ LET ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ


ﺮﺘﺷ ﺩﺭﻮﻣ ﻭ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

:ﺪﻧﺍ ﻩﺩﺮﮐ ﻩﺩﺎﻔﺘﺳﺍ ﺮﯿﻐﺘﻣ ﻡﺎﻧ ﮏﯾ ﻪﺑ ﻪﻤﻠﮐ ﺪﻨﭼ ﻕﺎﺤﻟﺍ ﯼﺍﺮﺑ ﯽﻔﻠﺘﺨﻣ ﯼﺎﻫ ﺵﻭﺭ ﺯﺍ ﻥﺎﺴﯾﻮﻧ ﻪﻣﺎﻧﺮﺑ ،ﯽﺨﯾﺭﺎﺗ ﻅﺎﺤﻟ ﺯﺍ

ﻦﻔﯿﻫ:

.ﯼﺮﻬﺷ ﻦﯿﺑ ،ﺕﺭﺎﮐ ﺮﺘﺴﻣ ،ﯽﮔﺩﺍﻮﻧﺎﺧ ﻡﺎﻧ ،ﻡﺎﻧ

.ﺪﻧﺍ ﻩﺪﺷ ﻭﺭﺯﺭ ﻖﯾﺮﻔﺗ ﯼﺍﺮﺑ ﺎﻬﻧﺁ .ﺖﺴﯿﻧ ﺯﺎﺠﻣ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﺩ ﻪﻠﺻﺎﻓ ﻂﺧ

ﻂﺧ ﺮﯾﺯ:

first_name، ﯽﮔﺩﺍﻮﻧﺎﺧ ﻡﺎﻧ، master_card، inter_city.

(ﻝﺎﮑﺳﺎﭘ ﺏﺎﻗ) ﯽﯾﻻﺎﺑ ﺮﺘﺷ ﺏﺎﻗ:

FirstName، LastName، MasterCard، InterCity.

ﻦﯿﯾﺎﭘ ﺮﺘﺷ ﻪﺒﻌﺟ:

:ﺩﻮﺷ ﯽﻣ ﻉﻭﺮﺷ ﮏﭼﻮﮐ ﻑﻭﺮﺣ ﺎﺑ ﻪﮐ ﺪﻨﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ camel case ﺯﺍ ﺪﻧﺭﺍﺩ ﻞﯾﺎﻤﺗ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻥﺎﺴﯾﻮﻧ ﻪﻣﺎﻧﺮﺑ

firstName, lastName, mastercard, interCity.


ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺎﻫﺮﺘﮐﺍﺭﺎﮐ ﻪﻋﻮﻤﺠﻣ

.ﺪﻨﮐ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ﺪﮑﯿﻧﻮﯾ ﺮﺘﮐﺍﺭﺎﮐ ﻪﻋﻮﻤﺠﻣ ﺯﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

.ﺪﻫﺩ ﯽﻣ ﺶﺷﻮﭘ ﺍﺭ ﻥﺎﻬﺟ ﯼﺎﻫﺩﺎﻤﻧ ﻭ ﯼﺭﺍﺬﮔ ﻪﻄﻘﻧ ﻢﺋﻼﻋ ،ﺎﻫﺮﺘﮐﺍﺭﺎﮐ ﻡﺎﻤﺗ (ﺎﺒﯾﺮﻘﺗ) ﺪﮑﯿﻧﻮﯾ

.ﺪﯿﻨﮐ ﻪﻌﻟﺎﻄﻣ ﺍﺭ ﺎﻣ ﺪﮑﯿﻧﻮﯾ ﻞﻣﺎﮐ ﻊﺟﺮﻣ ﺎﻔﻄﻟ ،ﺮﺗ ﻖﯿﻗﺩ ﻩﺎﮕﻧ ﯼﺍﺮﺑ

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