freeCodeCamp/curriculum/challenges/arabic/02-javascript-algorithms-an.../basic-algorithm-scripting/reverse-a-string.arabic.md

2.0 KiB

id title isRequired challengeType videoUrl localeTitle
a202eed8fc186c8434cb6d61 Reverse a String true 5 عكس سلسلة

Description

عكس السلسلة المقدمة. قد تحتاج إلى تحويل السلسلة إلى مصفوفة قبل أن تتمكن من عكسها. يجب أن تكون النتيجة الخاصة بك سلسلة. تذكر استخدام Read-Search-Ask إذا واجهتك مشكلة. اكتب الكود الخاص بك.

Instructions

Tests

tests:
  - text: <code>reverseString(&quot;hello&quot;)</code> يجب إرجاع سلسلة.
    testString: 'assert(typeof reverseString("hello") === "string", "<code>reverseString("hello")</code> should return a string.");'
  - text: يجب أن تصبح <code>reverseString(&quot;hello&quot;)</code> <code>&quot;olleh&quot;</code> .
    testString: 'assert(reverseString("hello") === "olleh", "<code>reverseString("hello")</code> should become <code>"olleh"</code>.");'
  - text: يجب أن تصبح <code>reverseString(&quot;Howdy&quot;)</code> <code>&quot;ydwoH&quot;</code> .
    testString: 'assert(reverseString("Howdy") === "ydwoH", "<code>reverseString("Howdy")</code> should become <code>"ydwoH"</code>.");'
  - text: يجب أن ترجع <code>reverseString(&quot;Greetings from Earth&quot;)</code> <code>&quot;htraE morf sgniteerG&quot;</code> .
    testString: 'assert(reverseString("Greetings from Earth") === "htraE morf sgniteerG", "<code>reverseString("Greetings from Earth")</code> should return <code>"htraE morf sgniteerG"</code>.");'

Challenge Seed

function reverseString(str) {
  return str;
}

reverseString("hello");

Solution

// solution required