+=
operator لسَلسَلة سلسلة في نهاية متغير سلسلة موجود. يمكن أن يكون هذا مفيدًا جدًا لكسر سلسلة طويلة عبر عدة أسطر. ملحوظة myStr
عبر عدة سطور عن طريق وصل هاتين السلسلتين: "This is the first sentence. "
و "This is the second sentence."
باستخدام +=
عامل التشغيل. استخدم +=
عامل مشابه لكيفية ظهوره في المحرر. ابدأ بتخصيص السلسلة الأولى إلى myStr
، ثم أضفها في السلسلة الثانية. myStr
قيمة This is the first sentence. This is the second sentence.
testString: 'assert(myStr === "This is the first sentence. This is the second sentence.", "myStr
should have a value of This is the first sentence. This is the second sentence.
");'
- text: استخدم +=
عامل لبناء myStr
testString: 'assert(code.match(/\w\s*\+=\s*[""]/g).length > 1 && code.match(/\w\s*\=\s*[""]/g).length > 1, "Use the +=
operator to build myStr
");'
```