--- id: afcc8d540bea9ea2669306b6 title: Repeat a String Repeat a String isRequired: true challengeType: 5 videoUrl: '' localeTitle: كرر سلسلة يكرر سلسلة --- ## Description
كرر str سلسلة معينة (الوسيطة الأولى) لـ num times (الوسيطة الثانية). إرجاع سلسلة فارغة إذا لم تكن num رقم موجب. تذكر استخدام Read-Search-Ask إذا واجهتك مشكلة. اكتب الكود الخاص بك.
## Instructions
## Tests
```yml tests: - text: 'يجب أن ترجع repeatStringNumTimes("*", 3) "***" .' testString: 'assert(repeatStringNumTimes("*", 3) === "***", "repeatStringNumTimes("*", 3) should return "***".");' - text: 'يجب أن ترجع repeatStringNumTimes("abc", 3) "abcabcabc" .' testString: 'assert(repeatStringNumTimes("abc", 3) === "abcabcabc", "repeatStringNumTimes("abc", 3) should return "abcabcabc".");' - text: 'يجب أن ترجع repeatStringNumTimes("abc", 4) "abcabcabcabc" .' testString: 'assert(repeatStringNumTimes("abc", 4) === "abcabcabcabc", "repeatStringNumTimes("abc", 4) should return "abcabcabcabc".");' - text: 'يجب أن ترجع repeatStringNumTimes("abc", 1) "abc" .' testString: 'assert(repeatStringNumTimes("abc", 1) === "abc", "repeatStringNumTimes("abc", 1) should return "abc".");' - text: 'يجب أن ترجع repeatStringNumTimes("*", 8) "********" .' testString: 'assert(repeatStringNumTimes("*", 8) === "********", "repeatStringNumTimes("*", 8) should return "********".");' - text: 'يجب أن ترجع repeatStringNumTimes("abc", -2) "" .' testString: 'assert(repeatStringNumTimes("abc", -2) === "", "repeatStringNumTimes("abc", -2) should return "".");' - text: لا يجب استخدام repeat() المدمج repeat() -method testString: 'assert(!/\.repeat/g.test(code), "The built-in repeat()-method should not be used");' ```
## Challenge Seed
```js function repeatStringNumTimes(str, num) { // repeat after me return str; } repeatStringNumTimes("abc", 3); ```
## Solution
```js // solution required ```