Files
freeCodeCamp/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md
2022-12-19 20:41:09 +02:00

2.5 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
587d7b84367417b2b2512b35 إدراك الأخطاء الإملائية في أسماء المتغيرات والوظيفة (Catch Misspelled Variable and Function Names) 1 301186 catch-misspelled-variable-and-function-names

--description--

يكونا console.log() و typeof الطرقتان الرئيستان للتحقق من القيم وأنواعها في الكود. الآن حان الوقت للدخول في الأشكال الشائعة التي تأخذها الأخطاء (bugs). أحد المشاكل ويقع فيه بالذات الكتبة السريعين هو الخطأ الإملائي المتواضع (humble spelling error).

الأحرف المبدلة، المفقودة، أو الأحرف كبيرة بالخطأ (mis-capitalized) في اسم متغير أو وظيفة سيجعل المتصفح يبحث عن شيء غير موجود - ويبلغ عن خطأ مرجعي (reference error). في لغة JavaScript أسماء المتغير والوظائف هي حساسة لحالة الأحرف (case-sensitive).

--instructions--

أصحّح الخطأين الإملائيان في الكود بحيث تجري العملية الحسابية netWorkingCapital بشكل صحيح.

--hints--

تحقق من أملاء المتغيرات المستخدمَين في حساب netWorkingCapital، يجب أن يظهر النص الآتي "Net working capital is: 2" في وحدة التحكم.

assert(netWorkingCapital === 2);

لا ينبغي أن تكون هناك استخدامات للمتغيرات تملى بشكل خاطئ في الكود.

assert(!code.match(/recievables/g));

يجب إعلان متغير باسم receivables واستخدامه بشكل صحيح في الكود.

assert(code.match(/receivables/g).length == 2);

لا ينبغي أن تكون هناك استخدامات للمتغيرات تملى بشكل خاطئ في الكود.

assert(!code.match(/payable;/g));

يجب إعلان متغير باسم payables واستخدامه بشكل صحيح في الكود.

assert(code.match(/payables/g).length == 2);

--seed--

--seed-contents--

let receivables = 10;
let payables = 8;
let netWorkingCapital = recievables - payable;
console.log(`Net working capital is: ${netWorkingCapital}`);

--solutions--

let receivables = 10;
let payables = 8;
let netWorkingCapital = receivables - payables;
console.log(`Net working capital is: ${netWorkingCapital}`);