Skip to content

Commit b7b4b01

Browse files
Merge pull request #3 from javascript-tutorial/sync-29a3c58d
Sync with upstream @ 29a3c58
2 parents 318a451 + b7e4056 commit b7b4b01

1,140 files changed

Lines changed: 35217 additions & 4210 deletions

File tree

Some content is hidden

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

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

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

77

88

9+
<<<<<<< HEAD
910
## جاوا اسکریپت چیست
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
1014
1115

1216

@@ -39,7 +43,11 @@
3943
[موتور جاوااِسکریپت](https://en.wikipedia.org/wiki/JavaScript_engine)
4044
وجود داشته باشد، این زبان قابلیت اجرا شدن را داراست.
4145

46+
<<<<<<< HEAD
4247
مرورگرهای وب دارای موتوری داخلی برای اجرای جاوا اِسکریپت هستند، که گاهی آن را **ماشین مجازی جاوا** **اِسکریپت** نیز می‌نامند.
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
4351
4452

4553

@@ -59,7 +67,11 @@
5967

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

70+
<<<<<<< HEAD
6271

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
6375
6476
**موتورها** **چگونه کار** **می‌کنند**
6577

@@ -71,6 +83,7 @@
7183

7284

7385

86+
<<<<<<< HEAD
7487
۱. موتور در ابتدا اِسکریپت را می‌خواند (Parse).
7588

7689

@@ -190,6 +203,14 @@
190203

191204

192205
نمونه‌هایی از این زبان‌ها :
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
193214
194215

195216

-480 Bytes
Loading
-1.66 KB
Loading

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

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

4747
![safari](safari.png)
4848

49+
<<<<<<< HEAD
4950
حالا `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
5062
5163
## ورودی چند خطی
5264

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

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

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

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

78
پس ابتدا نگاهی به نحوه متصل کردن یک اسکریپت به یک صفحه وب می‌اندازیم. اگر در محیط 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
816
917
## تگِ script
1018

125 Bytes
Loading
746 Bytes
Loading

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

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

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

156+
<<<<<<< HEAD
156157
در ادامه آموزش در بخش <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: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ alert("some code");
6565
})()
6666
```
6767

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

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

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

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

56+
<<<<<<< HEAD
5657
این مورد ممکن است کوتاه‌تر به نظر آید اما ما پیشنهاد نمی‌کنیم. چراکه خوانایی را پایین می‌آورد. لطفا برای تعریف متغیرها از خطوط جداگانه استفاده کنید :
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
5763
5864
```js
5965
let user = 'John';
@@ -132,8 +138,13 @@ alert(hello); // Hello world!
132138
alert(message); // Hello world!
133139
```
134140
141+
<<<<<<< HEAD
135142
```smart header="زبان‌های Functional"
136143
جالب است بدانید زبان‌های [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
137148
138149
در این نوع زبان‌ها وقتی مقداری را در جعبه قرار می‌دهیم تا ابد آنجا می‌ماند و اگر بخواهیم مقداری دیگر را ذخیره کنیم، ما را مجبور می‌کنند تا جعبه‌ای جدید بسازیم.
139150
@@ -155,7 +166,11 @@ let userName;
155166
let test123;
156167
```
157168
169+
<<<<<<< HEAD
158170
زمانی‌که به یک نام متشکل از چند کلمه است، عموما از روش [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
159174
160175
همینطور از `'$'` و `'_'` نیز می‌توان استفاده نمود. معنی خاصی ندارند و همانند حروف قابل استفاده هستند.
161176
@@ -180,8 +195,13 @@ let my-name; // hyphens '-' aren't allowed in the name
180195
متغیر apple با Apple متفاوت است.
181196
```
182197
198+
<<<<<<< HEAD
183199
````smart header="کاراکترهای غیر انگلیسی مجاز هستند ولی توصیه نمی‌شوند"
184200
امکان استفاده از کاراکترهای زبان‌های دیگر وجود دارد. مانند :
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
185205
186206
```js
187207
let имя = '...';
@@ -251,7 +271,11 @@ myBirthday = '01.01.2001'; // error, can't reassign the constant!
251271
252272
به صورت یک عُرفِ همه‌گیر، از ثابت‌های با حروف بزرگ به عنوان نام مستعار برای مقادیری که به خاطر سپردن آنها دشوار است، استفاده می‌شود. این دسته از ثابت‌ها اصطلاحا prior to execution (پیش از اجرای برنامه) مقدارشان قطعی است.
253273
274+
<<<<<<< HEAD
254275
در ثابت‌ها از حروف بزرگ و _ استفاده می‌شود :
276+
=======
277+
For instance, let's make constants for colors in so-called "web" (hexadecimal) format:
278+
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
255279
256280
```js run
257281
const COLOR_RED = "#F00";
@@ -285,7 +309,11 @@ const pageLoadTime = /* time taken by a webpage to load */;
285309
286310
## نام‌های مناسب انتخاب کنید
287311
312+
<<<<<<< HEAD
288313
لطفا نام متغیرهای خود را با حساسیت انتخاب کنید و برای اینکار خوب فکر کنید.
314+
=======
315+
A variable name should have a clean, obvious meaning, describe the data that it stores.
316+
>>>>>>> 29a3c58d72b8f10f9f1f9ce5cf691d2ab44a9d01
289317
290318
انتخاب نام برای متغیرها یکی از کارهای مهم و پیچیده در برنامه‌نویسی است. یک نگاه سریع به نام متغیرها می‌تواند تفاوت یک برنامه‌نویس تازه‌کار و با تجربه را نشان دهد.
291319

0 commit comments

Comments
 (0)