freeCodeCamp/curriculum/challenges/arabic/02-javascript-algorithms-an.../basic-javascript/concatenating-strings-with-...

2.5 KiB

id title challengeType videoUrl localeTitle
56533eb9ac21ba0edf2244b7 Concatenating Strings with Plus Operator 1 سلاسل متسلسلة مع Plus Operator

Description

في JavaScript ، عندما يتم استخدام عامل التشغيل + مع قيمة String ، يطلق عليه عامل التشغيل السلسة . يمكنك إنشاء سلسلة جديدة خارج السلاسل الأخرى عن طريق وصلها معًا. مثال
"اسمي ألان ،" + "أنا سلسلته".
ملحوظة
احترس من المساحات. لا يضيف Concatenation فراغات بين السلاسل المتسلسلة ، لذا ستحتاج إلى إضافتها بنفسك.

Instructions

بناء myStr من السلاسل "This is the start. " و "This is the end." باستخدام عامل + .

Tests

tests:
  - text: يجب أن يكون لـ <code>myStr</code> قيمة <code>This is the start. This is the end.</code>
    testString: 'assert(myStr === "This is the start. This is the end.", "<code>myStr</code> should have a value of <code>This is the start. This is the end.</code>");'
  - text: استخدم عامل التشغيل <code>+</code> لبناء <code>myStr</code>
    testString: 'assert(code.match(/([""]).*([""])\s*\+\s*([""]).*([""])/g).length > 1, "Use the <code>+</code> operator to build <code>myStr</code>");'
  - text: يجب إنشاء <code>myStr</code> باستخدام الكلمة الرئيسية <code>var</code> .
    testString: 'assert(/var\s+myStr/.test(code), "<code>myStr</code> should be created using the <code>var</code> keyword.");'
  - text: تأكد من تعيين النتيجة لمتغير <code>myStr</code> .
    testString: 'assert(/myStr\s*=/.test(code), "Make sure to assign the result to the <code>myStr</code> variable.");'

Challenge Seed

// Example
var ourStr = "I come first. " + "I come second.";

// Only change code below this line

var myStr;

After Test

console.info('after the test');

Solution

// solution required