Course / دورة
Programming basicsأساسيات البرمجة
The logic before the language: values, decisions, repetition, functions
المنطق قبل اللغة: القيم والقرارات والتكرار والدوال
beginner 23 lessons 7 chapters 14 hours
0 / 23 lessons completed / دروس مكتملة
What you will be able to do / ماذا ستستطيع أن تفعل
- Store, compare and change values with confidence تخزّن القيم وتقارنها وتغيّرها بثقة
- Write conditions and loops that do what you meant تكتب شروطًا وحلقات تفعل ما قصدته
- Break a problem into functions instead of one long file تقسّم المشكلة إلى دوال بدل ملف واحد طويل
- Read an error message and work out what to do about it تقرأ رسالة الخطأ وتستنتج ما ينبغي فعله
1 Before the codeقبل الكود 2
-
1
What a program is / ما هو البرنامج
Before any syntax: a program is a list of instructions, followed exactly, in order, by something that understands nothing. Most beginner difficulty comes from forgetting the last part.
قبل أي صيغة: البرنامج قائمة تعليمات تُتَّبع بالضبط بالترتيب من شيء لا يفهم شيئًا. ومعظم صعوبة المبتدئ تأتي من نسيان الجزء الأخير.
-
2
Running JavaScript, three ways / تشغيل JavaScript بثلاث طرق
Nothing to install. The console for trying one line, a script tag for a page, and a file for anything real — plus the one command that shows you what a program is thinking.
لا شيء يُثبَّت. السجل لتجربة سطر، ووسم script لصفحة، وملف لأي شيء حقيقي — وأمر واحد يريك ما يفكر فيه البرنامج.
2 Valuesالقيم 6
-
3
Variables: giving a value a name / المتغيّرات: إعطاء القيمة اسمًا
A variable is a labelled box. Almost everything else in programming assumes you are comfortable with three ideas: naming, assigning, and the fact that a name can be reused for a new value.
المتغيّر صندوق موسوم. وكل ما عداه في البرمجة تقريبًا يفترض ارتياحك لثلاث أفكار: التسمية والإسناد وأن الاسم يمكن إعادة استخدامه لقيمة جديدة.
-
4
Types: what kind of value is this / الأنواع: أي نوع من القيم هذا
Every value has a kind, and the kind decides what the operators do. Confusing a number with a string of digits is the single most common beginner bug in JavaScript.
لكل قيمة نوع، والنوع يقرر ما تفعله المعاملات. والخلط بين رقم ونص من الأرقام أشيع عيب مبتدئ في JavaScript.
-
5
Numbers and arithmetic / الأرقام والحساب
The operators are the ones you know from school, with two additions worth learning — and one famous surprise about decimals that every language shares and every beginner meets.
المعاملات هي التي تعرفها من المدرسة، مع إضافتين تستحقان التعلم — ومفاجأة شهيرة عن الكسور تشترك فيها كل اللغات ويقابلها كل مبتدئ.
-
6
Strings: working with text / النصوص: التعامل مع الكلام
Most of what a program handles is text — names, addresses, messages. A handful of methods cover nearly everything, and one modern piece of syntax makes building a sentence readable.
ومعظم ما يعالجه البرنامج نص — أسماء وعناوين ورسائل. وحفنة من الدوال تغطي كل شيء تقريبًا، وقطعة صيغة حديثة تجعل بناء جملة مقروءًا.
-
7
True, false, and comparing things / صح وخطأ ومقارنة الأشياء
Every decision a program makes comes down to one value: true or false. Producing that value is what comparison operators do — and one of them in JavaScript should simply never be used.
كل قرار يتخذه برنامج يعود إلى قيمة واحدة: صح أو خطأ. وإنتاج تلك القيمة هو ما تفعله معاملات المقارنة — وواحد منها في JavaScript لا ينبغي استخدامه إطلاقًا.
-
8
Reading an error message / قراءة رسالة الخطأ
Errors are the most useful output a program produces, and beginners skip them. Four messages cover almost everything you will see for the first year.
الأخطاء أنفع مخرَج ينتجه البرنامج، والمبتدئون يتخطونها. وأربع رسائل تغطي كل ما ستراه تقريبًا في السنة الأولى.
3 Decisionsالقرارات 3
-
9
Making a decision: if and else / اتخاذ قرار: if وelse
The second of the three things a program can do. One keyword, one condition, and the shape that every branch in every language takes.
الثاني من الأشياء الثلاثة التي يستطيعها البرنامج. كلمة واحدة وشرط واحد، والشكل الذي يتخذه كل تفرّع في كل لغة.
-
10
Combining conditions: and, or, not / جمع الشروط: و، أو، ليس
Three operators let one condition ask several questions at once. They behave exactly as the words do in ordinary speech, with one useful extra: they stop as soon as the answer is settled.
ثلاثة معاملات تتيح لشرط واحد أن يسأل أسئلة عدة معًا. وتتصرف كما تتصرف الكلمات في الكلام العادي، مع إضافة نافعة: أنها تتوقف ما إن يُحسم الجواب.
-
11
Truthiness, and choosing from many / الصدقية، والاختيار من كثير
JavaScript will accept any value where a true or false is expected, and it has opinions about which are which. Plus switch, for when an if chain is really one question with many answers.
تقبل JavaScript أي قيمة حيث يُتوقع صح أو خطأ، ولها آراء في أيها أيّ. وكذلك switch، حين تكون سلسلة if في الحقيقة سؤالًا واحدًا بأجوبة كثيرة.
4 Repetitionالتكرار 3
-
12
Repeating: the while loop / التكرار: حلقة while
The third thing a program can do. A while loop is the simplest form and the one that shows the machinery clearly — including the mistake that freezes the browser.
الثالث مما يستطيعه البرنامج. وحلقة while أبسط صيغة وهي التي تُظهر الآلة بوضوح — بما فيه الخطأ الذي يجمّد المتصفح.
-
13
The for loop / حلقة for
The same three parts as a while loop, gathered onto one line so they cannot be forgotten. This is the loop you will write most, and the one whose shape is worth knowing by heart.
الأجزاء الثلاثة نفسها من حلقة while، مجموعة في سطر واحد فلا تُنسى. وهذه هي الحلقة التي ستكتبها أكثر، والتي يستحق شكلها الحفظ.
-
14
Leaving a loop early: break and continue / مغادرة الحلقة مبكرًا: break وcontinue
Two words that change how a loop runs. One stops it completely, the other skips to the next round — and knowing them turns several awkward loops into simple ones.
كلمتان تغيّران كيف تعمل الحلقة. إحداهما توقفها تمامًا والأخرى تقفز إلى الدورة التالية — ومعرفتهما تحوّل عدة حلقات محرجة إلى بسيطة.
5 Collectionsالمجموعات 3
-
15
Arrays: a list of values / المصفوفات: قائمة قيم
One name holding many values, in order. Almost every real program has a list in it, and the numbering starts at zero — which is the source of the classic mistake.
اسم واحد يحمل قيمًا كثيرة بالترتيب. وكل برنامج حقيقي تقريبًا فيه قائمة، والترقيم يبدأ من صفر — وهو مصدر الخطأ الكلاسيكي.
-
16
Array methods: find, filter, map, reduce / دوال المصفوفات: find وfilter وmap وreduce
Four methods replace most of the loops you would otherwise write, and each one says what it is doing in its name. This is where JavaScript starts reading like a description of the result.
أربع دوال تحل محل معظم الحلقات التي كنت ستكتبها، وكل واحدة تقول ما تفعله في اسمها. وهنا تبدأ JavaScript في القراءة كوصف للنتيجة.
-
17
Objects: values with names / الكائنات: قيم بأسماء
An array numbers its values; an object names them. Once a thing has more than two properties, an object is what stops you remembering which position the price was in.
المصفوفة ترقّم قيمها؛ والكائن يسمّيها. وما إن يصير للشيء أكثر من خاصيتين، حتى يكون الكائن هو ما يمنعك من تذكّر أي موضع كان فيه السعر.
6 Functionsالدوال 3
-
18
Functions: naming a piece of work / الدوال: تسمية قطعة عمل
A function is a set of steps with a name, so you can run them from anywhere by saying the name. It is how a program stops being one long list and starts being something you can read.
الدالة مجموعة خطوات لها اسم، فتستطيع تشغيلها من أي مكان بقول الاسم. وهي كيف يكفّ البرنامج عن كونه قائمة طويلة واحدة ويبدأ في كونه شيئًا تستطيع قراءته.
-
19
Parameters and return / الوسائط والإرجاع
What goes in and what comes out. Getting these two right is most of what makes a function reusable — and there is one silent mistake that makes a function look broken when it is not.
ما يدخل وما يخرج. وضبط هذين معظم ما يجعل الدالة قابلة لإعادة الاستخدام — وثمة خطأ صامت يجعل الدالة تبدو معطلة وهي ليست كذلك.
-
20
Scope: where a name can be seen / النطاق: أين يُرى الاسم
A variable exists inside the braces it was declared in, and nowhere else. That one rule explains "is not defined", explains why functions are safe to reuse, and explains why var is avoided.
المتغيّر يوجد داخل الأقواس التي أُعلن فيها ولا مكان آخر. وتلك القاعدة وحدها تفسّر "is not defined"، وتفسّر لماذا يؤمَن إعادة استخدام الدوال، وتفسّر لماذا يُتجنَّب var.
7 Thinking like a programmerالتفكير كمبرمج 3
-
21
How to approach a problem you cannot see the answer to / كيف تتناول مشكلة لا ترى جوابها
The part nobody teaches. Everything so far was vocabulary; this is the method for turning a problem you have never seen into a program, and it works even when you have no idea where to start.
الجزء الذي لا يعلّمه أحد. فكل ما سبق مفردات؛ وهذا هو المنهج لتحويل مشكلة لم ترها قط إلى برنامج، وهو ينجح حتى حين لا تعرف من أين تبدأ.
-
22
Eight problems to solve / ثماني مسائل تحلها
No new material. Eight problems in rising order of difficulty, each solvable with what the previous twenty-one lessons contain — and each with its awkward cases named for you.
لا مادة جديدة. ثماني مسائل بترتيب صاعد في الصعوبة، كل واحدة قابلة للحل بما في الدروس الواحد والعشرين السابقة — وكل واحدة حالاتها المحرجة مسمّاة لك.
-
23
Project: a small program that does something real / مشروع: برنامج صغير يفعل شيئًا حقيقيًا
The last lesson introduces nothing. Build one program that uses everything in this course, for a problem you actually have — and write down how you built it, not only what you built.
الدرس الأخير لا يقدّم جديدًا. ابنِ برنامجًا واحدًا يستخدم كل ما في هذه الدورة، لمشكلة لديك فعلًا — واكتب كيف بنيته لا ما بنيته فقط.