Skip to content

Commit c9d440f

Browse files
Merge pull request #4 from javascript-tutorial/revert-3-sync-29a3c58d
Revert "Sync with upstream @ 29a3c58"
2 parents b7b4b01 + 685ac72 commit c9d440f

File tree

1,140 files changed

+4210
-35217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,140 files changed

+4210
-35217
lines changed

1-js/01-getting-started/1-intro/article.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66

77

88

9-
<<<<<<< HEAD
109
## جاوا اسکریپت چیست
11-
=======
12-
The programs in this language are called *scripts*. They can be written right in a web page's HTML and run automatically as the page loads.
13-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
1410

1511

1612

@@ -43,11 +39,7 @@ The programs in this language are called *scripts*. They can be written right in
4339
[موتور جاوااِسکریپت](https://en.wikipedia.org/wiki/JavaScript_engine)
4440
وجود داشته باشد، این زبان قابلیت اجرا شدن را داراست.
4541

46-
<<<<<<< HEAD
4742
مرورگرهای وب دارای موتوری داخلی برای اجرای جاوا اِسکریپت هستند، که گاهی آن را **ماشین مجازی جاوا** **اِسکریپت** نیز می‌نامند.
48-
=======
49-
JavaScript's capabilities greatly depend on the environment it's running in. For instance, [Node.js](https://wikipedia.org/wiki/Node.js) supports functions that allow JavaScript to read/write arbitrary files, perform network requests, etc.
50-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
5143

5244

5345

@@ -67,11 +59,7 @@ JavaScript's capabilities greatly depend on the environment it's running in. For
6759

6860
بخاطر سپردن این نام‌ها مفید هستند، چراکه در مقالات مختلف به آنها بر خواهید خورد، همینطور زمانیکه ما در این آموزش برای نمونه می‌گوییم ویژگی X توسط موتور **V8** پشتیبانی می‌شود، یعنی به احتمال زیاد در مرورگرهای کروم و اپرا پشتیبانی خواهد شد.
6961

70-
<<<<<<< HEAD
7162

72-
=======
73-
This is called the "Same Origin Policy". To work around that, *both pages* must agree for data exchange and contain a special JavaScript code that handles it. We'll cover that in the tutorial.
74-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
7563

7664
**موتورها** **چگونه کار** **می‌کنند**
7765

@@ -83,7 +71,6 @@ JavaScript's capabilities greatly depend on the environment it's running in. For
8371

8472

8573

86-
<<<<<<< HEAD
8774
۱. موتور در ابتدا اِسکریپت را می‌خواند (Parse).
8875

8976

@@ -203,14 +190,6 @@ JavaScript's capabilities greatly depend on the environment it's running in. For
203190

204191

205192
نمونه‌هایی از این زبان‌ها :
206-
=======
207-
```compare
208-
+ Full integration with HTML/CSS.
209-
+ Simple things are done simply.
210-
+ Support by all major browsers and enabled by default.
211-
```
212-
JavaScript is the only browser technology that combines these three things.
213-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
214193

215194

216195

480 Bytes
Loading
Loading

1-js/01-getting-started/3-devtools/article.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,7 @@
4646

4747
![safari](safari.png)
4848

49-
<<<<<<< HEAD
5049
حالا `cmd + opt + c` می‌‌تواند پنل توسعه دهندگان را باز کند.
51-
=======
52-
Now `key:Cmd+Opt+C` can toggle the console. Also, note that the new top menu item named "Develop" has appeared. It has many commands and options.
53-
54-
## Multi-line input
55-
56-
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.
57-
58-
To insert multiple lines, press `key:Shift+Enter`.
59-
60-
## Summary
61-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
6250

6351
## ورودی چند خطی
6452

1-js/02-first-steps/01-hello-world/article.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
# Hello, world!
22

3-
<<<<<<< HEAD
43
آموزش پیش روی شما مفاهیم هسته‌ای جاوا اسکریپت است که وابسته به پلتفرم نیست. در ادامه با پلتفرم‌هایی مانند Node.JS و نحوه استفاده از آنها آشنا خواهیم شد.
54

65
ما برای اجرای اسکریپت‌هایی که می‌نویسیم به محیطی برای اجرا نیاز داریم و از آنجایی که این یک دوره آنلاین است، مرورگر انتخاب خوبی است. سعی ما بر این است تا از دستوراتی که اختصاصا مربوط به مرورگر هستند مانند `alert` کمتر استفاده کنیم. مخصوصا برای شمایی قصد استفاده از جاوا اسکریپت در پلتفرم‌های دیگری چون Node.JS را دارید.
76

87
پس ابتدا نگاهی به نحوه متصل کردن یک اسکریپت به یک صفحه وب می‌اندازیم. اگر در محیط Server Side هستید (مانند Node.JS) می‌توانید از این دستور برای اجرای اسکریپت استفاده نمایید : `node my.js`
9-
=======
10-
The tutorial that you're reading is about core JavaScript, which is platform-independent. Later on, you'll learn about Node.js and other platforms that use it.
11-
12-
But we need a working environment to run our scripts and, since this book is online, the browser is a good choice. We'll keep the amount of browser-specific commands (like `alert`) to a minimum so that you don't spend time on them if you plan to concentrate on another environment (like Node.js). We'll focus on JavaScript in the browser in the [next part](/ui) of the tutorial.
13-
14-
So first, let's see how we attach a script to a webpage. For server-side environments (like Node.js), you can execute the script with a command like `"node my.js"`.
15-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
168

179
## تگِ script
1810

Loading
Loading

1-js/02-first-steps/02-structure/article.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,4 @@ alert( 'World' );
153153

154154
Comment ها حجم کد را افزایش می‌دهند، اما این اصلا اشکال نیست. ابزارهای گوناگونی وجود دارند که قبل از انتشار برنامه روی سروِر کدهای شما را کم حجم و Comment ها را حذف می‌کنند. بنابراین Comment ها روی خروجی نهایی تاثیری نخواهند داشت.
155155

156-
<<<<<<< HEAD
157156
در ادامه آموزش در بخش <info:coding-style> نحوه بهتر نوشتن Comment ها را خواهیم آموخت.
158-
=======
159-
Later in the tutorial there will be a chapter <info:code-quality> that also explains how to write better comments.
160-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01

1-js/02-first-steps/03-strict-mode/article.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ alert("some code");
6565
})()
6666
```
6767

68+
## همیشه از "use strict" استفاده کنید
69+
70+
ما همچنان باید به آموختن تفاوت‌های use strict و default mode ادامه دهیم.
71+
6872
در بخش‌های بعدی که با قابلیت‌های زبان جاوا اسکریپت آشنا می‌شویم، به تفاوت‌های بین strict mode و "default" mode اشاره خواهیم کرد و خواهیم دید که use strict چطور زندگی ما را راحت‌تر کرده است.
6973

7074
تا به اینجا کافیست بدانید :

1-js/02-first-steps/04-variables/article.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,7 @@ alert(message); // Hello!
5353
let user = 'John', age = 25, message = 'Hello';
5454
```
5555

56-
<<<<<<< HEAD
5756
این مورد ممکن است کوتاه‌تر به نظر آید اما ما پیشنهاد نمی‌کنیم. چراکه خوانایی را پایین می‌آورد. لطفا برای تعریف متغیرها از خطوط جداگانه استفاده کنید :
58-
=======
59-
That might seem shorter, but we don't recommend it. For the sake of better readability, please use a single line per variable.
60-
61-
The multiline variant is a bit longer, but easier to read:
62-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
6357

6458
```js
6559
let user = 'John';
@@ -138,13 +132,8 @@ alert(hello); // Hello world!
138132
alert(message); // Hello world!
139133
```
140134
141-
<<<<<<< HEAD
142135
```smart header="زبان‌های Functional"
143136
جالب است بدانید زبان‌های [functional](https://en.wikipedia.org/wiki/Functional_programming) مانند [Scala](http://www.scala-lang.org/) یا [Erlang](http://www.erlang.org/) تغییر مقدار متغیر را ممنوع کرده‌اند.
144-
=======
145-
```smart header="Functional languages"
146-
It's interesting to note that there exist [functional](https://en.wikipedia.org/wiki/Functional_programming) programming languages, like [Scala](http://www.scala-lang.org/) or [Erlang](http://www.erlang.org/) that forbid changing variable values.
147-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
148137
149138
در این نوع زبان‌ها وقتی مقداری را در جعبه قرار می‌دهیم تا ابد آنجا می‌ماند و اگر بخواهیم مقداری دیگر را ذخیره کنیم، ما را مجبور می‌کنند تا جعبه‌ای جدید بسازیم.
150139
@@ -166,11 +155,7 @@ let userName;
166155
let test123;
167156
```
168157
169-
<<<<<<< HEAD
170158
زمانی‌که به یک نام متشکل از چند کلمه است، عموما از روش [camelCase](https://en.wikipedia.org/wiki/CamelCase) استفاده می‌شود. به این صورت که کلمات یکی پس از دیگری پشت هم نوشته می‌شوند و حرف اول هر کلمه کاراکتر بزرگ هست : `myVeryLongName` .
171-
=======
172-
When the name contains multiple words, [camelCase](https://en.wikipedia.org/wiki/CamelCase) is commonly used. That is: words go one after another, each word except first starting with a capital letter: `myVeryLongName`.
173-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
174159
175160
همینطور از `'$'` و `'_'` نیز می‌توان استفاده نمود. معنی خاصی ندارند و همانند حروف قابل استفاده هستند.
176161
@@ -195,13 +180,8 @@ let my-name; // hyphens '-' aren't allowed in the name
195180
متغیر apple با Apple متفاوت است.
196181
```
197182
198-
<<<<<<< HEAD
199183
````smart header="کاراکترهای غیر انگلیسی مجاز هستند ولی توصیه نمی‌شوند"
200184
امکان استفاده از کاراکترهای زبان‌های دیگر وجود دارد. مانند :
201-
=======
202-
````smart header="Non-Latin letters are allowed, but not recommended"
203-
It is possible to use any language, including cyrillic letters or even hieroglyphs, like this:
204-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
205185
206186
```js
207187
let имя = '...';
@@ -271,11 +251,7 @@ myBirthday = '01.01.2001'; // error, can't reassign the constant!
271251
272252
به صورت یک عُرفِ همه‌گیر، از ثابت‌های با حروف بزرگ به عنوان نام مستعار برای مقادیری که به خاطر سپردن آنها دشوار است، استفاده می‌شود. این دسته از ثابت‌ها اصطلاحا prior to execution (پیش از اجرای برنامه) مقدارشان قطعی است.
273253
274-
<<<<<<< HEAD
275254
در ثابت‌ها از حروف بزرگ و _ استفاده می‌شود :
276-
=======
277-
For instance, let's make constants for colors in so-called "web" (hexadecimal) format:
278-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
279255
280256
```js run
281257
const COLOR_RED = "#F00";
@@ -309,11 +285,7 @@ const pageLoadTime = /* time taken by a webpage to load */;
309285
310286
## نام‌های مناسب انتخاب کنید
311287
312-
<<<<<<< HEAD
313288
لطفا نام متغیرهای خود را با حساسیت انتخاب کنید و برای اینکار خوب فکر کنید.
314-
=======
315-
A variable name should have a clean, obvious meaning, describe the data that it stores.
316-
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
317289
318290
انتخاب نام برای متغیرها یکی از کارهای مهم و پیچیده در برنامه‌نویسی است. یک نگاه سریع به نام متغیرها می‌تواند تفاوت یک برنامه‌نویس تازه‌کار و با تجربه را نشان دهد.
319291

0 commit comments

Comments
 (0)