Skip to content

Commit

Permalink
Fixing some courses
Browse files Browse the repository at this point in the history
  • Loading branch information
TeaByte committed Feb 26, 2024
1 parent eb15964 commit 318a61e
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 36 deletions.
2 changes: 1 addition & 1 deletion courses/functions/global-scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ console.log(x);
```

<div class="quiz">
لا يوجد اختبار لهذا الدرس.
نعتذر عن عدم وجود اختبار لهذا الدرس حالياً. نحن نعمل بجد لإعداد اختبارات لجميع الدروس وسنقوم بتوفيرها في أقرب وقت ممكن.
</div>
2 changes: 2 additions & 0 deletions courses/functions/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,6 @@ const answer = plusThree(5);

<div class="quiz">
قم بكتابة دالة اسمها <code>area</code> تأخذ وسيطتين <code>width</code> و <code>height</code> وترجع مساحة المستطيل
<br>
ان علمت ان قانون المساحه هو <code>width * height</code>.
</div>
2 changes: 1 addition & 1 deletion courses/numbers/decimals.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ console.log(div); // 0.5
<div class="quiz">
1. اكتب كود جافاسكربت يخزّن الرقم العشري <code>3.14</code> في متغير يسمّى <code>myDecimal</code>.<br>
2. ثم اكتب كودًا يضرب <code>myDecimal</code> في <code>4</code> ويخزّن النتيجة في متغير يسمّى <code>product</code>.<br>
3. اطبع قيمة<code>product</code> إلى وحدة التحكم.<br>
3. اطبع قيمة <code>product</code> إلى وحدة التحكم.<br>
</div>
4 changes: 2 additions & 2 deletions courses/numbers/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ i--; // اصبح i = -1
```

<div class="quiz">
1- قم بحساب مساحة مستطيل بطول 5 وعرض 10.<br>
1- قم بحساب مساحة مستطيل بطول 5 وعرض 10. ان علمت ان مساحه المسطيل هي <code>length * width</code>.<br>
2- يجب عليك أن تخزن الطول في متغير <code>length</code> والعرض في متغير <code>width</code> ونتيجة الضرب في متغير <code>area</code>.<br>
3- يجب أن تطبع النتيجة في الكونسول.
3- يجب أن تطبع النتيجة في وحده التحكم.
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ console.log(myBreed);
</mark>

<div class="quiz">
قم بطاعة خاصية الدولة من الكائن <code>country</code> بستخدام المتغير المُخزن<code>Country</code>.
قم بطاعة خاصية الدولة (<code>country</code>) من الكائن <code>fighter</code> بأستحدام المتغير المُخزن <code>Country</code> في وحده التحكم.
</div>
12 changes: 7 additions & 5 deletions courses/objects/accessing-object-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ myObj["NoSpace"];
</mark>

<div class="quiz">
عندك كائن اسمه <code>fighter</code> ولديه الخصائص التالية:
<code>name</code>، <code>country</code>، <code>speed</code>، <code>maxAltitude</code>، و<code>maxAltitudeUnit</code>.
قم بالوصول لأقصى إرتفاع يمكن للطائرة الحربية <code>fighter</code> الوصول إليه من ثم قم بتحول الوحدة من <code>ft</code> إلى <code>m</code>.
لديك الكائن <code>fighter</code> ولديه الخصائص التالية:
<code>name</code>، <code>country</code>، <code>speed</code>، <code>maxAltitude</code>، و <code>maxAltitudeUnit</code>.
<br>
يعني حول الرقم من قدم إلى متر. 1 قدم = 0.3048 متر.
قم بالوصول لأقصى إرتفاع يمكن للطائرة الحربية <code>fighter</code> الوصول إليه.
<br>
يجب عليك طباعة النتيجة.
من ثم قم بتحول الوحدة من <code>ft</code> إلى <code>m</code>
اي حول الرقم من قدم (<code>ft</code>) إلى متر (<code>m</code>). ان علمت ان <code>1 قدم = 0.3048 متر</code>
<br>
يجب عليك طباعة النتيجة في وحده التحكم!.
</div>
2 changes: 1 addition & 1 deletion courses/objects/delete-properties-from-object.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ delete ourDog.bark;
```

<div class="quiz">
إحذف خاصية <code>operator</code> فقط.
إحذف خاصية <code>operator</code> من الكائن <code>fighter</code>.
</div>
11 changes: 7 additions & 4 deletions courses/objects/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ const anotherObject = {
جافاسكربت تلقائيًا بكتابتها كسلاسل.

<div class="quiz">
قم بإنشاء كائن يمثل السيارة "car"، ويحتوي على الخصائص التالية:<br>
- الصانع: "Toyota"<br>
- النموذج: "Corolla"<br>
إستخدم اللغة الإنجليزية لأسماء الخصائص. ترجمة الصانع إلى العربية هي "manufacturer"، وترجمة النموذج إلى العربية هي "model".
قم بإنشاء كائن يمثل السيارة <code>car</code>، ويحتوي على الخصائص التالية:<br>
- الصانع: <code>Toyota</code><br>
- النموذج: <code>Corolla</code><br>
<br>
⚠️ إستخدم اللغة الإنجليزية لأسماء الخصائص.
<br>
ترجمة الصانع إلى العربية هي <code>manufacturer</code>، وترجمة النموذج إلى العربية هي <code>model</code>.
</div>
3 changes: 1 addition & 2 deletions courses/objects/updating-object-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const ourDog = {
ourDog.bark = "bow-wow";
```


<div class="quiz">
قم بحول الكائن <code>fighter</code> إلى كائن يحتوي على خاصية <code>speed</code> بقيمة 2450 ووحدة قياسها km/h
قم بتحديث الكائن <code>fighter</code> إلى كائن يحتوي على خاصية <code>speed</code> بقيمة <code>2450</code>.
</div>
2 changes: 1 addition & 1 deletion courses/variables/uninitialized-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ console.log(c); // "undefined String!"
</mark>

<div class="quiz">
قم بتعريف أي متغير ثم غير قيمته إلى <code>عربي</code>.
قم بتعريف أي متغير ثم غير قيمته إلى كلمه <code>عربي</code>.
</div>
3 changes: 3 additions & 0 deletions precodes/functions/intro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function area() {
return null;
}
1 change: 1 addition & 0 deletions precodes/numbers/intro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const length = 5;
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ const fighter = {
maxAltitude: 65000,
maxAltitudeUnit: 'ft',
}

const Country = 'country';
3 changes: 3 additions & 0 deletions precodes/objects/intro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let car = {
// ...
}
7 changes: 4 additions & 3 deletions testcases/functions/intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ function handleCodeRun(code) {
return `${error}`;
}
}
code += "\nconsole.log(area(5, 5));"
code += "\nconsole.log(area(5, 75));"
const output = handleCodeRun(code);
console.log(output);
if (output) {
if (output === "25") {
if (output.includes("375")) {
isPass = true;
msg = "مبروك الحل صحيح"
} else {
isPass = false;
msg = "هناك خطاء ما"
msg = "هناك خطاء ما تأكد من شروط الاختبار"
}
}
2 changes: 1 addition & 1 deletion testcases/objects/delete-properties-from-object.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// if code contain `delete fighter.operator` then isPass = true
if (code.includes("delete fighter.operator")) {
if (code.includes("delete") && code.includes("operator") && code.includes("fighter")) {
isPass = true;
} else {
isPass = false;
Expand Down
23 changes: 9 additions & 14 deletions testcases/objects/updating-object-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,13 @@ function handleCodeRun(code) {
return `${error}`;
}
}
// if the code contain console.log() write message
if (code.includes("console.log(")) {
isPass = false;
msg = "اكتب الجواب بدون استخدام console.log";

code += "\nconsole.log(fighter.speed+fighter.speedUnit)"
const output = handleCodeRun(code);
const expectedOutput = "2450";
if (output.includes(expectedOutput)) {
isPass = true;
} else {
code += "\nconsole.log(fighter.speed+fighter.speedUnit)"
const output = handleCodeRun(code);
const expectedOutput = "2450km/h";
if (output == expectedOutput) {
isPass = true;
} else {
isPass = false;
msg = "الله يبارك فيك ركز شوية وحاول مره ثانية"
}
}
isPass = false;
msg = "الله يبارك فيك ركز شوية وحاول مره ثانية"
}

0 comments on commit 318a61e

Please sign in to comment.