Skip to content

Commit caa37a6

Browse files
authored
Merge branch 'master' into master
2 parents 159820c + a91a281 commit caa37a6

106 files changed

Lines changed: 2256 additions & 2030 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/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# مقدمة
22

3-
عن لغة جافا سكريبت و البيئة التي تُطَوّرْ بها.
3+
عن لغة جافا سكريبت والبيئة التي تُطَوّرْ بها.
Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Hello, world!
1+
# أهلاً، بالعالم!
22

3-
This part of the tutorial is about core JavaScript, the language itself.
3+
هذا الجزء من البرنامج التعليمي عن أساسيات لغة الجافا سكريبت، اللغة نفسها.
44

5-
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.
5+
لكن نحتاج إلى بيئة عمل من أجل تشغيل النصوص الخاصة بنا، وبما أن هذا الكتاب عبر الانترنت، لذافإن المتصفح خيار جيد. سوف نقوم بالاحتفاظ بالأوامر الخاصة بالمتصفح (مثل `alert`) للحد الأدنى بحيث لا تقضي وقتًا عليها إذا كنت تخطط للتركيز على بيئة أخرى (مثل Node.js). سوف نركز على الجافا سكريبت في المتصفح [الجزء التالي](/ui) من البرنامج التعليمي.
66

7-
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"`.
7+
لذا أولاً، دعونا نرفق نصا برمجيا في صفحة الويب. بالنسبة للبيئات التي تعمل على الخوادم (مثل Node.js)، يمكنك تنفيذها من خلال استخدام أمر مثل `"node my.js"`.
88

99

10-
## The "script" tag
10+
## الوسم "script"
1111

12-
JavaScript programs can be inserted into any part of an HTML document with the help of the `<script>` tag.
12+
يمكن وضع برامج الجافاسكريبت في أي جزء في مستند HTML باستخدام وسم `<script>`.
1313

14-
For instance:
14+
على سبيل المثال:
1515

1616
```html run height=100
1717
<!DOCTYPE HTML>
@@ -23,7 +23,7 @@ For instance:
2323

2424
*!*
2525
<script>
26-
alert( 'Hello, world!' );
26+
alert( 'أهلاً، بالعالم!' );
2727
</script>
2828
*/!*
2929

@@ -35,53 +35,53 @@ For instance:
3535
```
3636

3737
```online
38-
You can run the example by clicking the "Play" button in the right-top corner of the box above.
38+
يمكن أن تقوم بتشغيل المثال بالضغط على زر "تشغيل" في الجانب الأيمن العلوي بالمربع الأعلى.
3939
```
4040

41-
The `<script>` tag contains JavaScript code which is automatically executed when the browser processes the tag.
41+
الوسم `<script>` يحتوي على شفرات جافاسكريبت التي يمكن أن تُنفذ بشكل تلقائي عندما يقوم المتصفح بمعالجة الوسم.
4242

4343

44-
## Modern markup
44+
## الترميز الحديث
4545

46-
The `<script>` tag has a few attributes that are rarely used nowadays but can still be found in old code:
46+
الوسم `<script>` يحتوي على بعض الخصائص التي نادراً مايتم استخدامها في وقتنا الحاضر، لكن يمكن أن تجدها في الشفرات البرمجية القديمة:
4747

48-
The `type` attribute: <code>&lt;script <u>type</u>=...&gt;</code>
49-
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard totally changed the meaning of this attribute. Now, it can be used for JavaScript modules. But that's an advanced topic, we'll talk about modules in another part of the tutorial.
48+
الخاصية `type`: <code>&lt;script <u>type</u>=...&gt;</code>
49+
: معيار HTML القديم، HTML4، يتطلب أن يحتوي وسم script على `type`. عادة ما كان `type="text/javascript"`. لم تعد مطلوبة الآن. وأيضاً، معايير HTML الحديثة غيرت معنى هذه الخاصية. والآن، يمكن أن تستخدم لوحدات الجافا سكريبت. لكن هذا الموضوع متقدم، وسنتحدث عن الوحدات في جزء آخر من البرنامج التعليمي.
5050

51-
The `language` attribute: <code>&lt;script <u>language</u>=...&gt;</code>
52-
: This attribute was meant to show the language of the script. This attribute no longer makes sense because JavaScript is the default language. There is no need to use it.
51+
الخاصية `language`: <code>&lt;script <u>language</u>=...&gt;</code>
52+
: كان الغرض من استخدام هذه الخاصية هو إظهار لغة النص البرمجي، لم تعد هذه الخاصية منطقية الآن لأن الجافا سكريبت هي اللغة الافتراضية. فليست هناك حاجة لاستخدامها.
5353

54-
Comments before and after scripts.
55-
: In really ancient books and guides, you may find comments inside `<script>` tags, like this:
54+
التعليقات قبل وبعد النصوص البرمجية.
55+
: في الكتب والأدلة القديمة جداً، قد تجد تعليقات داخل وسم `<script>`، مثل هذا:
5656

5757
```html no-beautify
5858
<script type="text/javascript"><!--
5959
...
6060
//--></script>
6161
```
6262

63-
This trick isn't used in modern JavaScript. These comments hide JavaScript code from old browsers that didn't know how to process the `<script>` tag. Since browsers released in the last 15 years don't have this issue, this kind of comment can help you identify really old code.
63+
لا يتم استخدام هذه الخدعة في الجافاسكريبت الحديثة. تخفي هذه التعليقات شفرات الجافاسكريبت في المتصفحات القديمة التي لاتعرف كيفية عمل معالجة للوسم `<script>. نظراً لأن المتصفحات التي تم إصدارها في آخر 15 عاماً لا توجد فيها هذه المشكلة، فإن هذا النوع من التعليقات يمكن أن يساعدك في تحديد الشفرة القديمة حقاً.
6464

6565

66-
## External scripts
66+
## النصوص البرمجية الخارجية
6767

68-
If we have a lot of JavaScript code, we can put it into a separate file.
68+
إذا كان لدينا عدد كبير من شيفرات الجافا سكريبت، فإننا يمكن أن نضعها في ملف منفصل.
6969

70-
Script files are attached to HTML with the `src` attribute:
70+
يتم إرفاق ملفات النصوص البرمجية HTML باستخدام خاصية `src`:
7171

7272
```html
7373
<script src="/path/to/script.js"></script>
7474
```
7575

76-
Here, `/path/to/script.js` is an absolute path to the script from the site root. One can also provide a relative path from the current page. For instance, `src="script.js"` would mean a file `"script.js"` in the current folder.
76+
هنا، `/path/to/script.js` هو مسار منفرد للنص البرمجي من جذر الموقع. يمكن أيضاً توفير مسار نسبي من خلال الصفحة الحالية. على سبيل المثال، `src="script.js"` تعني أن الملف `"script.js"` في نفس المجلد.
7777

78-
We can give a full URL as well. For instance:
78+
يمكن أن نعطي المسار الكامل أيضاً. على سبيل المثال :
7979

8080
```html
8181
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.js"></script>
8282
```
8383

84-
To attach several scripts, use multiple tags:
84+
لكي نرفق العديد من النصوص البرمجية، استخدم To attach several scripts، use الوسوم بصورة مضاعفة:
8585

8686
```html
8787
<script src="/js/script1.js"></script>
@@ -90,29 +90,29 @@ To attach several scripts, use multiple tags:
9090
```
9191

9292
```smart
93-
As a rule, only the simplest scripts are put into HTML. More complex ones reside in separate files.
93+
القاعدة أن يتم وضع النصوص البرمجية البسيطة داخل HTML. والنصوص المعقدة يتم وضعها في ملفات منفصلة.
9494
95-
The benefit of a separate file is that the browser will download it and store it in its [cache](https://en.wikipedia.org/wiki/Web_cache).
95+
فائدة الملفات المنفصلة هي أن المتصفح يقوم بتحميلها وتخزينها في [ذاكرة التخزين المؤقتة](https://en.wikipedia.org/wiki/Web_cache).
9696
97-
Other pages that reference the same script will take it from the cache instead of downloading it, so the file is actually downloaded only once.
97+
الصفحات الأخرى التي تشير إلى نفس النص البرمجي سوف تحصل عليه من ذاكرة التخزين المؤقتة بدلاً من تنزيله، لذا فإن الملف يتم تحميله مرة واحدة.
9898
99-
That reduces traffic and makes pages faster.
99+
هذا يقلل من الحركة ويجعل الصفحات تكون أسرع.
100100
```
101101

102-
````warn header="If `src` is set, the script content is ignored."
103-
A single `<script>` tag can't have both the `src` attribute and code inside.
102+
````warn header="إذا `src` تم تعيين، يتم تجاهل محتوى النص البرمجي."
103+
وسم `<script>` منفرداً لايمكن أن يحتوي على خاصية `src` والشيفرة بداخله.
104104

105-
This won't work:
105+
هذا لايعمل:
106106

107107
```html
108108
<script *!*src*/!*="file.js">
109109
alert(1); // the content is ignored, because src is set
110110
</script>
111111
```
112112

113-
We must choose either an external `<script src="…">` or a regular `<script>` with code.
113+
يجب اختيار إما خارجي `<script src="…">` أو عادي `<script>` باستخدام الشيفرة.
114114

115-
The example above can be split into two scripts to work:
115+
يمكن تقسيم المثال أعلاه إلى نصين برمجيين لكي يعمل:
116116

117117
```html
118118
<script src="file.js"></script>
@@ -122,11 +122,10 @@ The example above can be split into two scripts to work:
122122
```
123123
````
124124
125-
## Summary
125+
## ملخص
126126
127-
- We can use a `<script>` tag to add JavaScript code to a page.
128-
- The `type` and `language` attributes are not required.
129-
- A script in an external file can be inserted with `<script src="path/to/script.js"></script>`.
127+
- يمكن استخدام وسم `<script>` لإضافة شيفرة الجافا سكريبت إلى صفحة.
128+
- الخصائص `type` و`language` غير مطلوبة.
129+
- يمكن إدراج النص البرمجي في ملف خارجي باستخدام `<script src="path/to/script.js"></script>`.
130130
131-
132-
There is much more to learn about browser scripts and their interaction with the webpage. But let's keep in mind that this part of the tutorial is devoted to the JavaScript language, so we shouldn't distract ourselves with browser-specific implementations of it. We'll be using the browser as a way to run JavaScript, which is very convenient for online reading, but only one of many.
131+
هناك الكثير لتتعلمه عن نصوص المتصفح البرمجية وتفاعلها مع صفحة الويب. ولكن دعنا نضع في اعتبارنا أن هذا الجزء من البرنامج التعليمي مخصص للغة جافا سكريبت، لذلك لا ينبغي أن نشتت انتباهنا بالتطبيقات الخاصة بالمتصفح. سنستخدم المتصفح وسيلةً لتشغيل جافا سكريبت، وهو مناسب جدًا للقراءة عبر الإنترنت، ولكنه واحد فقط من بين العديد.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ For example:
1919
...
2020
```
2121

22-
Quite soon we're going to learn functions (a way to group commands) soon, so let's note in advance that `"use strict"` can be put at the beginning of a function. Doing that enables strict mode in that function only. But usually people use it for the whole script.
22+
Quite soon we're going to learn functions (a way to group commands), so let's note in advance that `"use strict"` can be put at the beginning of a function. Doing that enables strict mode in that function only. But usually people use it for the whole script.
2323

2424
````warn header="Ensure that \"use strict\" is at the top"
2525
Please make sure that `"use strict"` is at the top of your scripts, otherwise strict mode may not be enabled.

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ let user = 'John'
8383

8484
تقنيا, كل هذه الطرق تؤدي لنفس الشئ. لذلك, انها مسألة ذوق وجمال شخصي.
8585

86-
8786
````smart header="`var` بدلا من `let`"
88-
في الاصدارات الاقدم, قد تجد ايضا كلمة اخري: `var` بدلا من `let`
87+
في الاصدارات الاقدم, قد تجد ايضا كلمة اخري: `var` بدلا من `let`:
8988

9089
```js
9190
*!*var*/!* message = 'Hello';
@@ -136,6 +135,20 @@ alert(hello); // Hello world!
136135
alert(message); // Hello world!
137136
```
138137
138+
````warn header="Declaring twice triggers an error"
139+
A variable should be declared only once.
140+
141+
A repeated declaration of the same variable is an error:
142+
143+
```js run
144+
let message = "This";
145+
146+
// repeated 'let' leads to an error
147+
let message = "That"; // SyntaxError: 'message' has already been declared
148+
```
149+
So, we should declare a variable once and then refer to it without `let`.
150+
````
151+
139152
```smart header="Functional languages"
140153
من المثير للاهتمام ملاحظة وجود [وظيفي](https://en.wikipedia.org/wiki/Functional_programming) لغات برمجه, مثل [Scala](http://www.scala-lang.org/) او [Erlang](http://www.erlang.org/) تمنع تغيير قيم المتغير.
141154
@@ -191,7 +204,8 @@ let имя = '...';
191204
let 我 = '...';
192205
```
193206
194-
تقنياً, لا يوجد خطأ هنا, مثل هذه الاسماء مسموح بها, ولكن هناك تقاليد عالميه لأستخدام اللغه الانجليزيه في أسماء المتغيرات. حتي لو كنا نكتب نصاً صغيراً, قد يكون لها حياة طويله في المستقبل. الناس من مختلف البلاد ربما يحتاجوا لقرأءتها في بنفس الكتابة.
207+
تقنياً, لا يوجد خطأ هنا, مثل هذه الاسماء مسموح بها, ولكن هناك تقاليد عالميه لأستخدام اللغه الانجليزيه في أسماء المتغيرات. حتي لو كنا نكتب نصاً صغيراً, قد يكون لها حياة طويله في المستقبل. الناس من مختلف البلاد ربما يحتاجوا لقرأءتها لبعض الوقت.
208+
195209
````
196210

197211
````warn header="الأسماء المحجوزه"
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

2-
Backticks embed the expression inside `${...}` into the string.
2+
Backticks تضمن التعبير داخل `${...}` في داخل النص.
33

44
```js run
55
let name = "Ilya";
66

7-
// the expression is a number 1
7+
// التعبير هو رقم 1
88
alert( `hello ${1}` ); // hello 1
99

10-
// the expression is a string "name"
10+
// التعبير هو نص "name"
1111
alert( `hello ${"name"}` ); // hello name
1212

13-
// the expression is a variable, embed it
13+
// التعبير هو متغير ، يتضمنه
1414
alert( `hello ${name}` ); // hello Ilya
1515
```

1-js/02-first-steps/05-types/1-string-quotes/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 5
44

55
# String quotes
66

7-
What is the output of the script?
7+
ما ناتج هذا الكود ؟
88

99
```js
1010
let name = "Ilya";

0 commit comments

Comments
 (0)