4.4 KiB
4.4 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
56533eb9ac21ba0edf2244b6 | Escape Sequences in Strings | 1 | الهروب من التسلسل في السلاسل |
Description
الشفرة | انتاج | |
---|---|
\' | اقتباس واحد |
\" | اقتباس مزدوج |
\\ | مائل |
\n | خط جديد |
\r | إرجاع |
\t | التبويب |
\b | مسافة للخلف |
\f | نموذج تغذية |
Instructions
myStr
متغير واحد باستخدام تسلسلات الهروب. السطر الأولستحتاج إلى استخدام تسلسلات الهروب لإدراج أحرف خاصة بشكل صحيح. ستحتاج أيضًا إلى اتباع التباعد كما يبدو أعلاه ، مع عدم وجود مسافات بين تتابعات الهروب أو الكلمات. هنا هو النص مع تسلسل الهروب مكتوبة.
\السطر الثاني
ThirdLine
FirstLinenewline
tab
backslash
SecondLinenewline
ThirdLine
Tests
tests:
- text: يجب ألا تحتوي <code>myStr</code> على أية مسافات
testString: 'assert(!/ /.test(myStr), "<code>myStr</code> should not contain any spaces");'
- text: يجب أن تحتوي <code>myStr</code> على السلاسل <code>FirstLine</code> و <code>SecondLine</code> و <code>ThirdLine</code> (تذكر حالة الحساسية)
testString: 'assert(/FirstLine/.test(myStr) && /SecondLine/.test(myStr) && /ThirdLine/.test(myStr), "<code>myStr</code> should contain the strings <code>FirstLine</code>, <code>SecondLine</code> and <code>ThirdLine</code> (remember case sensitivity)");'
- text: يجب أن يتبع <code>FirstLine</code> حرف السطر الجديد <code>\n</code>
testString: 'assert(/FirstLine\n/.test(myStr), "<code>FirstLine</code> should be followed by the newline character <code>\n</code>");'
- text: يجب أن تحتوي <code>myStr</code> على حرف tab <code>\t</code> يتبع حرف السطر الجديد
testString: 'assert(/\n\t/.test(myStr), "<code>myStr</code> should contain a tab character <code>\t</code> which follows a newline character");'
- text: <code>SecondLine</code> يجب أن يسبقه حرف مائل <code>\\</code>
testString: 'assert(/\SecondLine/.test(myStr), "<code>SecondLine</code> should be preceded by the backslash character <code>\\</code>");'
- text: يجب أن يكون هناك حرف سطر جديد بين <code>SecondLine</code> و <code>ThirdLine</code>
testString: 'assert(/SecondLine\nThirdLine/.test(myStr), "There should be a newline character between <code>SecondLine</code> and <code>ThirdLine</code>");'
Challenge Seed
var myStr; // Change this line
After Test
console.info('after the test');
Solution
// solution required