You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A code editor is the place where programmers spend most of their time.
3
+
محرر الأكواد هو المكان الذي يقضي فيه المبرمجون معظم وقتهم.
4
4
5
-
There are two main types of code editors: IDEs and lightweight editors. Many people use one tool of each type.
5
+
يوجد نوعين من محررات الأكواد: IDEs ( بيئة التطوير الكاملة)و المحررات البسيطة. العديد من الناس يستخدمون أداة واحدة لكل نوع.
6
6
7
7
## IDE
8
8
9
-
The term [IDE](https://en.wikipedia.org/wiki/Integrated_development_environment) (Integrated Development Environment) refers to a powerful editor with many features that usually operates on a "whole project." As the name suggests, it's not just an editor, but a full-scale "development environment."
9
+
مصطلح [IDE](https://en.wikipedia.org/wiki/Integrated_development_environment) (Integrated Development Environment) يشير إلى محرر بإمكانات هائلة، مع العديد من المميزات التي تعمل عادة على " مشروع كامل". كما يوحي الاسم، فهو ليس مجرد محرر أكواد، ولكنه "بيئة تطوير" واسعة النطاق.
10
10
11
-
An IDE loads the project (which can be many files), allows navigation between files, provides autocompletion based on the whole project (not just the open file), and integrates with a version management system (like[git](https://git-scm.com/)), a testing environment, and other "project-level" stuff.
11
+
IDE تقوم بتحميل المشروع ) الذي يمكن أن يتكون من العديد من الملفات)، ويسمح بالتنقل بين الملفات، ويوفر خاصة الإكمال التلقائي المعتمدة على المشروع ككل ( وليس الملف المفتوح فقط) , كما أنه يمكن أن يرتبط مع أنظمة إدارة الإصدار (مثل[git](https://git-scm.com/)), وبيئة الاختبار, وغيرها من الأشياء على مستوى المشروع.
12
12
13
-
If you haven't selected an IDE yet, consider the following options:
13
+
إذا لم تقم باختيار IDE بعد ، ففكر في الخيارات التالية:
14
14
15
-
-[Visual Studio Code](https://code.visualstudio.com/) (cross-platform, free).
-[فيجوال ستديو كود](https://code.visualstudio.com/) (يعمل على أكثر من نظام تشغيل, مجاني).
16
+
-[ويب ستورم](http://www.jetbrains.com/webstorm/) (يعمل على أكثر من نظام تشغيل, مدفوع).
17
17
18
-
For Windows, there's also "Visual Studio", not to be confused with "Visual Studio Code". "Visual Studio" is a paid and mighty Windows-only editor, well-suited for the .NET platform. It's also good at JavaScript. There's also a free version[Visual Studio Community](https://www.visualstudio.com/vs/community/).
18
+
بالنسبة للويندوز، يمكن استخدام برنامج فيجوال ستديو، لايجب الخلط بينه وبين الفيجوال ستديو كود، فيجوال ستديو هو محرر مدفوع يعمل على نظام ويندوز فقك، ومناسب تماماً لبيئة الدوت نت. أنه أيضاً جيد للجافاسكريبت. كما يوجد إصدار مجاني منه[Visual Studio Community](https://www.visualstudio.com/vs/community/).
19
19
20
-
Many IDEs are paid, but have a trial period. Their cost is usually negligible compared to a qualified developer's salary, so just choose the best one for you.
20
+
.عادة ما تكون تكلفتها ضئيلة للغاية مقارنة براتب المطور المؤهل ، لذلك فقط اختر الأفضل بالنسبة لك.العديد من بيئات التطوير مدفوعة، لكن لها فترة سماحية
21
21
22
-
## Lightweight editors
22
+
## المحررات البسيطة
23
23
24
-
"Lightweight editors" are not as powerful as IDEs, but they're fast, elegant and simple.
24
+
المحررات البسيطة" ليست بقوة ال" IDEs لكنها سريعة, وأنيقة وبسيطة
25
25
26
-
They are mainly used to open and edit a file instantly.
26
+
يتم استخدامها بشكل رئيسي لفتح وتحرير ملف على الفور.
27
27
28
-
The main difference between a "lightweight editor" and an "IDE" is that an IDE works on a project-level, so it loads much more data on start, analyzes the project structure if needed and so on. A lightweight editor is much faster if we need only one file.
28
+
الفارق الرئيسي بين المحررات البسيطة و "بيئة التطوير" هو أن بيئة التطوير تعمل على مستوى المشروع، لذلك فإنها تقوم بتحميل المزيد من البيانات عند البدء، وتحليل هيكل المشروع إذا لزم ذلك. أما المحررات البسيطة فإنها أسرع في حال نريد ملف واحد فقط.
29
29
30
-
In practice, lightweight editors may have a lot of plugins including directory-level syntax analyzers and autocompleters, so there's no strict border between a lightweight editor and an IDE.
30
+
من الناحية العملية ، قد تحتوي المحررات البسيطة على الكثير من المكونات الإضافية بما في ذلك محللات بناء الجملة على مستوى الدليل وأجهزة الإكمال التلقائي ، لذلك لا توجد حدود صارمة بين المحرر البسيط و IDE.
31
31
32
-
The following options deserve your attention:
32
+
الخيارات التالية تستحق انتباهك:
33
33
34
-
-[Atom](https://atom.io/) (cross-platform, free).
35
-
-[Visual Studio Code](https://code.visualstudio.com/) (cross-platform, free).
-[Vim](http://www.vim.org/)و[Emacs](https://www.gnu.org/software/emacs/) رائعة إذا كنت تعرف كيفية استخدامها.
39
39
40
-
## Let's not argue
40
+
## دعونا لانتشاجر
41
41
42
-
The editors in the lists above are those that either I or my friends whom I consider good developers have been using for a long time and are happy with.
42
+
المحررات التي بالقائمة الأعلى هي التي نقوم باستخدامها أنا وأصدقائي، والذين أعتقد أنهم مطورون جيدون يستخدمونها منذ وقت طويل وتسعدهم.
43
43
44
-
There are other great editors in our big world. Please choose the one you like the most.
44
+
يوجد أيضاً محررات رائعة في عالمنا الكبير، الرجاء اختيار المحرر الذي تفضله.
45
45
46
-
The choice of an editor, like any other tool, is individual and depends on your projects, habits, and personal preferences.
46
+
اختيار المحرر، مثل أي أداة أخرى، هو اختيار فردي ويعتمد على مشروعاتك، وعاداتك، وتفضيلاتك الشخصية.
This part of the tutorial is about core JavaScript, the language itself.
3
+
هذا الجزء من البرنامج التعليمي عن أساسيات لغة الجافا سكريبت، اللغة نفسها.
4
4
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)من البرنامج التعليمي.
6
6
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"`.
8
8
9
9
10
-
## The "script" tag
10
+
## الوسم "script"
11
11
12
-
JavaScript programs can be inserted into any part of an HTML document with the help of the `<script>` tag.
12
+
يمكن وضع برامج الجافاسكريبت في أي جزء في مستند HTML باستخدام وسم`<script>`.
13
13
14
-
For instance:
14
+
على سبيل المثال:
15
15
16
16
```html run height=100
17
17
<!DOCTYPE HTML>
@@ -23,7 +23,7 @@ For instance:
23
23
24
24
*!*
25
25
<script>
26
-
alert( 'Hello, world!' );
26
+
alert( 'أهلاً, بالعالم!' );
27
27
</script>
28
28
*/!*
29
29
@@ -35,53 +35,53 @@ For instance:
35
35
```
36
36
37
37
```online
38
-
You can run the example by clicking the "Play" button in the right-top corner of the box above.
38
+
يمكن أن تقوم بتشغيل المثال بالضغط على زر "تشغيل" في الجانب الأيمن العلوي بالمربع الأعلى.
39
39
```
40
40
41
-
The`<script>`tag contains JavaScript code which is automatically executed when the browser processes the tag.
41
+
الوسم`<script>`يحتوي على شفرات جافاسكريبت التي يمكن أن تُنفذ بشكل تلقائي عندما يقوم المتصفح بمعالجة الوسم.
42
42
43
43
44
-
## Modern markup
44
+
## الترميز الحديث
45
45
46
-
The`<script>`tag has a few attributes that are rarely used nowadays but can still be found in old code:
46
+
الوسم`<script>`يحتوي على بعض الخصائص التي نادراً مايتم استخدامها في وقتنا الحاضر، لكن يمكن أن تجدها في الشفرات البرمجية القديمة:
: 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.
: معيار HTML القديم, HTML4, يتطلب أن يحتوي وسم script على`type`. عادة ما كان`type="text/javascript"`. لم تعد مطلوبة الآن. وأيضاً,معايير HTML الحديثةغيرت معني هذه الخاصية. والآن، يمكن أن تستخدم لوحدات الجافا سكريبت. لكن هذا الموضوع متقدم، وسنتحدث عن الوحدات في جزءآخر من البرنامج التعليمي.
: 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.
: كان الغرض من استخدام هذه الخاصية هو إظهار لغة النص البرمجي، لم تعد هذه الخاصية منطقية الآن لأن الجافا سكريبت هي اللغة الافتراضية. فليست هناك حاجة لاستخدامها.
53
53
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>`, مثل هذا:
56
56
57
57
```html no-beautify
58
58
<script type="text/javascript"><!--
59
59
...
60
60
//--></script>
61
61
```
62
62
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 عاماً لاتوجد فيها هذه المشكلة، فإن هذا النوع من التعليقات يمكن أن يساعدك في تحديد الشفرة القديمة حقاً.
64
64
65
65
66
-
## External scripts
66
+
## النصوص البرمجية الخارجية
67
67
68
-
If we have a lot of JavaScript code, we can put it into a separate file.
68
+
إذا كان لدينا عدد كبير من أكواد الجافا سكريبت، فإننا يمكن أن نضعها في ملف منفصل.
69
69
70
-
Script files are attached to HTML with the `src`attribute:
70
+
يتم إرفاق ملفات النصوص البرمجية HTML باستخدام خاصية `src` :
71
71
72
72
```html
73
73
<scriptsrc="/path/to/script.js"></script>
74
74
```
75
75
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"`في نفس المجلد.
77
77
78
-
We can give a full URL as well. For instance:
78
+
يمكن أن نعطي المسار الكامل أيضاً. على سبيل المثال :
لكي نرفق العديد من النصوص البرمجية، استخدم To attach several scripts, use الوسوم بصورة مضاعفة:
85
85
86
86
```html
87
87
<scriptsrc="/js/script1.js"></script>
@@ -90,29 +90,29 @@ To attach several scripts, use multiple tags:
90
90
```
91
91
92
92
```smart
93
-
As a rule, only the simplest scripts are put into HTML. More complex ones reside in separate files.
93
+
كقاعدة، يتم وضع النصوص البرمجية البسيطة داخل HTML. والنصوص المعقدة يتم وضعها في ملفات منفصلة.
94
94
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).
96
96
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
+
الصفحات الأخرى التي تشير إلى نفس النص البرمجي سوف تحصل عليه من ذاكرة التخزين المؤقتة بدلاً من تنزيله، لذا فإن الملف يتم تحميله مرة واحدة.
98
98
99
-
That reduces traffic and makes pages faster.
99
+
هذا يقلل من الحركة ويجعل الصفحات تكون أسرع.
100
100
```
101
101
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` والكود بداخله.
104
104
105
-
This won't work:
105
+
هذا لايعمل:
106
106
107
107
```html
108
108
<script*!*src*/!*="file.js">
109
109
alert(1); // the content is ignored, because src is set
110
110
</script>
111
111
```
112
112
113
-
We must choose either an external `<script src="…">`or a regular `<script>`with code.
113
+
يجب اختيار إما خارجي `<script src="…">`أو عادي `<script>`باستخدام الكود.
114
114
115
-
The example above can be split into two scripts to work:
115
+
يمكن تقسيم المثال أعلاه إلى نصين برمجيين لكي يعمل:
116
116
117
117
```html
118
118
<scriptsrc="file.js"></script>
@@ -122,11 +122,11 @@ The example above can be split into two scripts to work:
122
122
```
123
123
````
124
124
125
-
## Summary
125
+
## ملخص
126
126
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>`.
130
130
131
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.
132
+
هناك الكثير لتتعلمه عن نصوص المتصفح البرمجية وتفاعلها مع صفحة الويب. ولكن دعنا نضع في اعتبارنا أن هذا الجزء من البرنامج التعليمي مخصص للغة جافا سكريبت ، لذلك لا ينبغي أن نشتت انتباهنا بالتطبيقات الخاصة بالمتصفح. سنستخدم المتصفح كوسيلة لتشغيل جافا سكريبت ، وهو مناسب جدًا للقراءة عبر الإنترنت ، ولكن واحدًا فقط من بين العديد.
0 commit comments