| الشفرة | انتاج | |
|---|---|
\' | اقتباس واحد |
\" | اقتباس مزدوج |
\\ | مائل |
\n | خط جديد |
\r | إرجاع |
\t | التبويب |
\b | مسافة للخلف |
\f | نموذج تغذية |
myStr متغير واحد باستخدام تسلسلات الهروب. السطر الأولستحتاج إلى استخدام تسلسلات الهروب لإدراج أحرف خاصة بشكل صحيح. ستحتاج أيضًا إلى اتباع التباعد كما يبدو أعلاه ، مع عدم وجود مسافات بين تتابعات الهروب أو الكلمات. هنا هو النص مع تسلسل الهروب مكتوبة.
\السطر الثاني
ThirdLine
FirstLinenewlinetabbackslashSecondLinenewlineThirdLine
myStr على أية مسافات
testString: 'assert(!/ /.test(myStr), "myStr should not contain any spaces");'
- text: يجب أن تحتوي myStr على السلاسل FirstLine و SecondLine و ThirdLine (تذكر حالة الحساسية)
testString: 'assert(/FirstLine/.test(myStr) && /SecondLine/.test(myStr) && /ThirdLine/.test(myStr), "myStr should contain the strings FirstLine, SecondLine and ThirdLine (remember case sensitivity)");'
- text: يجب أن يتبع FirstLine حرف السطر الجديد \n
testString: 'assert(/FirstLine\n/.test(myStr), "FirstLine should be followed by the newline character \n");'
- text: يجب أن تحتوي myStr على حرف tab \t يتبع حرف السطر الجديد
testString: 'assert(/\n\t/.test(myStr), "myStr should contain a tab character \t which follows a newline character");'
- text: SecondLine يجب أن يسبقه حرف مائل \\
testString: 'assert(/\SecondLine/.test(myStr), "SecondLine should be preceded by the backslash character \\");'
- text: يجب أن يكون هناك حرف سطر جديد بين SecondLine و ThirdLine
testString: 'assert(/SecondLine\nThirdLine/.test(myStr), "There should be a newline character between SecondLine and ThirdLine");'
```