Add languages Russian, Arabic, Chinese, Portuguese (#18305)

This commit is contained in:
Beau Carnes
2018-10-10 18:03:03 -04:00
committed by mrugesh mohapatra
parent 09d3eca712
commit 2ca3a2093f
5517 changed files with 371466 additions and 5 deletions

View File

@ -0,0 +1,74 @@
---
id: a77dbc43c33f39daa4429b4f
title: Boo who
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: بو من
---
## Description
<section id="description"> تحقق مما إذا كانت القيمة مصنفة على أنها بدائية منطقية. إرجاع صح أو خطأ. الأجناس البولية هي صحيحة وكاذبة. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. حاول إقران البرنامج. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>booWho(true)</code> يجب أن <code>booWho(true)</code> true.
testString: 'assert.strictEqual(booWho(true), true, "<code>booWho(true)</code> should return true.");'
- text: <code>booWho(false)</code> يجب أن يعود صحيحًا.
testString: 'assert.strictEqual(booWho(false), true, "<code>booWho(false)</code> should return true.");'
- text: '<code>booWho([1, 2, 3])</code> يجب أن تعود خاطئة.'
testString: 'assert.strictEqual(booWho([1, 2, 3]), false, "<code>booWho([1, 2, 3])</code> should return false.");'
- text: 'يجب أن تعود <code>booWho([].slice)</code> كاذبة.'
testString: 'assert.strictEqual(booWho([].slice), false, "<code>booWho([].slice)</code> should return false.");'
- text: ''
testString: 'assert.strictEqual(booWho({ "a": 1 }), false, "<code>booWho({ "a": 1 })</code> should return false.");'
- text: يجب أن يقوم <code>booWho(1)</code> بإرجاع false.
testString: 'assert.strictEqual(booWho(1), false, "<code>booWho(1)</code> should return false.");'
- text: يجب أن تعود <code>booWho(NaN)</code> كاذبة.
testString: 'assert.strictEqual(booWho(NaN), false, "<code>booWho(NaN)</code> should return false.");'
- text: <code>booWho(&quot;a&quot;)</code> بإرجاع false.
testString: 'assert.strictEqual(booWho("a"), false, "<code>booWho("a")</code> should return false.");'
- text: <code>booWho(&quot;true&quot;)</code> بإرجاع false.
testString: 'assert.strictEqual(booWho("true"), false, "<code>booWho("true")</code> should return false.");'
- text: <code>booWho(&quot;false&quot;)</code> بإرجاع false.
testString: 'assert.strictEqual(booWho("false"), false, "<code>booWho("false")</code> should return false.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function booWho(bool) {
// What is the new fad diet for ghost developers? The Boolean.
return bool;
}
booWho(null);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,68 @@
---
id: a9bd25c716030ec90084d8a1
title: Chunky Monkey
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: قرد مكتنز
---
## Description
<section id="description"> اكتب دالة تقسم صفيف (أول وسيطة) إلى مجموعات طول <code>size</code> (وسيطة ثانية) وتقوم بإرجاعها كمصفوفة ثنائية الأبعاد. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>chunkArrayInGroups([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;], 2)</code> يجب أن ترجع <code>[[&quot;a&quot;, &quot;b&quot;], [&quot;c&quot;, &quot;d&quot;]]</code> .'
testString: 'assert.deepEqual(chunkArrayInGroups(["a", "b", "c", "d"], 2), [["a", "b"], ["c", "d"]], "<code>chunkArrayInGroups(["a", "b", "c", "d"], 2)</code> should return <code>[["a", "b"], ["c", "d"]]</code>.");'
- text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)</code> يجب أن تعود <code>[[0, 1, 2], [3, 4, 5]]</code> .'
testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5]]</code>.");'
- text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)</code> يجب أن ترجع <code>[[0, 1], [2, 3], [4, 5]]</code> .'
testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5]]</code>.");'
- text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)</code> return <code>[[0, 1, 2, 3], [4, 5]]</code> .'
testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5]]</code>.");'
- text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)</code> يجب أن تعود <code>[[0, 1, 2], [3, 4, 5], [6]]</code> .'
testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [[0, 1, 2], [3, 4, 5], [6]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5], [6]]</code>.");'
- text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)</code> يجب أن تعود <code>[[0, 1, 2, 3], [4, 5, 6, 7], [8]]</code> .'
testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [[0, 1, 2, 3], [4, 5, 6, 7], [8]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5, 6, 7], [8]]</code>.");'
- text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)</code> يجب أن تعود <code>[[0, 1], [2, 3], [4, 5], [6, 7], [8]]</code> .'
testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2), [[0, 1], [2, 3], [4, 5], [6, 7], [8]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5], [6, 7], [8]]</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function chunkArrayInGroups(arr, size) {
// Break it up.
return arr;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,77 @@
---
id: acda2fb1324d9b0fa741e6b5
title: Confirm the Ending
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: تأكيد الانتهاء
---
## Description
<section id="description"> تحقق مما إذا كانت سلسلة (الوسيطة الأولى ، <code>str</code> ) تنتهي بسلسلة الهدف المحددة (الوسيطة الثانية ، <code>target</code> ). <em>يمكن</em> حل هذا التحدي باستخدام طريقة <code>.endsWith()</code> ، التي تم تقديمها في ES2015. ولكن لغرض هذا التحدي ، نود منك استخدام إحدى طرق السلسلة الفرعية JavaScript بدلاً من ذلك. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>confirmEnding(&quot;Bastian&quot;, &quot;n&quot;)</code> يجب أن ترجع true.'
testString: 'assert(confirmEnding("Bastian", "n") === true, "<code>confirmEnding("Bastian", "n")</code> should return true.");'
- text: '<code>confirmEnding(&quot;Congratulation&quot;, &quot;on&quot;)</code> يجب أن تعود إلى true.'
testString: 'assert(confirmEnding("Congratulation", "on") === true, "<code>confirmEnding("Congratulation", "on")</code> should return true.");'
- text: '<code>confirmEnding(&quot;Connor&quot;, &quot;n&quot;)</code> يجب أن ترجع false.'
testString: 'assert(confirmEnding("Connor", "n") === false, "<code>confirmEnding("Connor", "n")</code> should return false.");'
- text: '<code>confirmEnding(&quot;Walking on water and developing software from a specification are easy if both are frozen&quot;, &quot;specification&quot;)</code> يجب أن تعود خاطئة.'
testString: 'assert(confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification") === false, "<code>confirmEnding("Walking on water and developing software from a specification are easy if both are frozen"&#44; "specification"&#41;</code> should return false.");'
- text: '<code>confirmEnding(&quot;He has to give me a new name&quot;, &quot;name&quot;)</code> يجب أن <code>confirmEnding(&quot;He has to give me a new name&quot;, &quot;name&quot;)</code> .'
testString: 'assert(confirmEnding("He has to give me a new name", "name") === true, "<code>confirmEnding("He has to give me a new name", "name")</code> should return true.");'
- text: '<code>confirmEnding(&quot;Open sesame&quot;, &quot;same&quot;)</code> يجب أن ترجع true.'
testString: 'assert(confirmEnding("Open sesame", "same") === true, "<code>confirmEnding("Open sesame", "same")</code> should return true.");'
- text: '<code>confirmEnding(&quot;Open sesame&quot;, &quot;pen&quot;)</code> يجب أن يقوم بإرجاع false.'
testString: 'assert(confirmEnding("Open sesame", "pen") === false, "<code>confirmEnding("Open sesame", "pen")</code> should return false.");'
- text: '<code>confirmEnding(&quot;Open sesame&quot;, &quot;game&quot;)</code> يجب أن ترجع false.'
testString: 'assert(confirmEnding("Open sesame", "game") === false, "<code>confirmEnding("Open sesame", "game")</code> should return false.");'
- text: '<code>confirmEnding(&quot;If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing&quot;, &quot;mountain&quot;)</code> يجب أن تعود كاذبة.'
testString: 'assert(confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain") === false, "<code>confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")</code> should return false.");'
- text: '<code>confirmEnding(&quot;Abstraction&quot;, &quot;action&quot;)</code> يجب أن <code>confirmEnding(&quot;Abstraction&quot;, &quot;action&quot;)</code> true.'
testString: 'assert(confirmEnding("Abstraction", "action") === true, "<code>confirmEnding("Abstraction", "action")</code> should return true.");'
- text: لا تستخدم الأسلوب <code>.endsWith()</code> لحل التحدي.
testString: 'assert(!(/\.endsWith\(.*?\)\s*?;?/.test(code)) && !(/\["endsWith"\]/.test(code)), "Do not use the built-in method <code>.endsWith()</code> to solve the challenge.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function confirmEnding(str, target) {
// "Never give up and good luck will find you."
// -- Falcor
return str;
}
confirmEnding("Bastian", "n");
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,66 @@
---
id: 56533eb9ac21ba0edf2244b3
title: Convert Celsius to Fahrenheit
challengeType: 1
isRequired: true
videoUrl: ''
localeTitle: تحويل مئوية إلى فهرنهايت
---
## Description
<section id="description"> الخوارزمية للتحويل من درجة مئوية إلى فهرنهايت هي درجة الحرارة في المرات المئوي <code>9/5</code> ، زائد <code>32</code> . يتم منحك درجة <code>celsius</code> متغيرة تمثل درجة الحرارة بالدرجة المئوية. استخدم المتغير <code>fahrenheit</code> تم تحديده بالفعل وقم بتعيينه درجة حرارة فهرنهايت مكافئة لدرجة حرارة مئوية معينة. استخدم الخوارزمية المذكورة أعلاه للمساعدة في تحويل درجة الحرارة مئوية إلى فهرنهايت. لا تقلق كثيراً بشأن بيانات الوظيفة والعودة حيث سيتم تغطيتها في التحديات المستقبلية. في الوقت الحالي ، استخدم فقط المشغلين الذين تعلموهم بالفعل. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يقوم <code>convertToF(0)</code> بإرجاع رقم
testString: 'assert(typeof convertToF(0) === "number", "<code>convertToF(0)</code> should return a number");'
- text: يجب أن تقوم <code>convertToF(-30)</code> بإرجاع قيمة <code>-22</code>
testString: 'assert(convertToF(-30) === -22, "<code>convertToF(-30)</code> should return a value of <code>-22</code>");'
- text: يجب أن تقوم <code>convertToF(-10)</code> بإرجاع قيمة <code>14</code>
testString: 'assert(convertToF(-10) === 14, "<code>convertToF(-10)</code> should return a value of <code>14</code>");'
- text: يجب أن تقوم <code>convertToF(0)</code> بإرجاع قيمة <code>32</code>
testString: 'assert(convertToF(0) === 32, "<code>convertToF(0)</code> should return a value of <code>32</code>");'
- text: يجب أن تقوم <code>convertToF(20)</code> بإرجاع قيمة <code>68</code>
testString: 'assert(convertToF(20) === 68, "<code>convertToF(20)</code> should return a value of <code>68</code>");'
- text: يجب أن تقوم <code>convertToF(30)</code> بإرجاع قيمة <code>86</code>
testString: 'assert(convertToF(30) === 86, "<code>convertToF(30)</code> should return a value of <code>86</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function convertToF(celsius) {
let fahrenheit;
return fahrenheit;
}
convertToF(30);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,63 @@
---
id: a302f7aae1aa3152a5b413bc
title: Factorialize a Number
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: Factorialize عدد
---
## Description
<section id="description"> عودة المضروب من عدد صحيح المقدمة. إذا تم تمثيل العدد الصحيح بالحرف n ، فإن العامل الحاسوبي هو نتاج جميع الأعداد الصحيحة الموجبة أقل من أو يساوي n. غالبًا ما يتم تمثيل العوامل بعبارة الاختزال <code>n!</code> على سبيل المثال: <code>5! = 1 * 2 * 3 * 4 * 5 = 120</code> فقط تزويد الأعداد الصحيحة التي تزيد عن أو تساوي الصفر بالوظيفة. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يعيد <code>factorialize(5)</code> رقمًا.
testString: 'assert(typeof factorialize(5) === "number", "<code>factorialize(5)</code> should return a number.");'
- text: يجب أن يعيد <code>factorialize(5)</code> 120.
testString: 'assert(factorialize(5) === 120, "<code>factorialize(5)</code> should return 120.");'
- text: يجب أن يعيد التجهيز <code>factorialize(10)</code> 3628800.
testString: 'assert(factorialize(10) === 3628800, "<code>factorialize(10)</code> should return 3628800.");'
- text: يجب أن تعيد إنتاجية <code>factorialize(20)</code> 2432902008176640000.
testString: 'assert(factorialize(20) === 2432902008176640000, "<code>factorialize(20)</code> should return 2432902008176640000.");'
- text: يجب أن يعيد <code>factorialize(0)</code> 1.
testString: 'assert(factorialize(0) === 1, "<code>factorialize(0)</code> should return 1.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function factorialize(num) {
return num;
}
factorialize(5);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,62 @@
---
id: adf08ec01beb4f99fc7a68f2
title: Falsy Bouncer
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: فلسى الحارس
---
## Description
<section id="description"> قم بإزالة كافة قيم الفالسة من صفيف. تكون قيم Falsy في JavaScript <code>false</code> و <code>null</code> و <code>0</code> و <code>&quot;&quot;</code> و <code>undefined</code> و <code>NaN</code> . تلميح: حاول تحويل كل قيمة إلى قيمة منطقية. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>bouncer([7, &quot;ate&quot;, &quot;&quot;, false, 9])</code> يجب أن يعود <code>[7, &quot;ate&quot;, 9]</code> .'
testString: 'assert.deepEqual(bouncer([7, "ate", "", false, 9]), [7, "ate", 9], "<code>bouncer([7, "ate", "", false, 9])</code> should return <code>[7, "ate", 9]</code>.");'
- text: 'يجب أن تعود <code>bouncer([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])</code> <code>[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]</code> .'
testString: 'assert.deepEqual(bouncer(["a", "b", "c"]), ["a", "b", "c"], "<code>bouncer(["a", "b", "c"])</code> should return <code>["a", "b", "c"]</code>.");'
- text: '<code>bouncer([false, null, 0, NaN, undefined, &quot;&quot;])</code> يجب أن يرجع <code>[]</code> .'
testString: 'assert.deepEqual(bouncer([false, null, 0, NaN, undefined, ""]), [], "<code>bouncer([false, null, 0, NaN, undefined, ""])</code> should return <code>[]</code>.");'
- text: '<code>bouncer([1, null, NaN, 2, undefined])</code> يجب أن يرجع <code>[1, 2]</code> .'
testString: 'assert.deepEqual(bouncer([1, null, NaN, 2, undefined]), [1, 2], "<code>bouncer([1, null, NaN, 2, undefined])</code> should return <code>[1, 2]</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function bouncer(arr) {
// Don't show a false ID to this bouncer.
return arr;
}
bouncer([7, "ate", "", false, 9]);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,65 @@
---
id: a26cbbe9ad8655a977e1ceb5
title: Find the Longest Word in a String
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: ابحث عن أطول كلمة في سلسلة
---
## Description
<section id="description"> إرجاع طول الكلمة الأطول في الجملة المتوفرة. يجب أن يكون ردك رقمًا. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>findLongestWordLength(&quot;The quick brown fox jumped over the lazy dog&quot;)</code> يجب إرجاع رقم.
testString: 'assert(typeof findLongestWordLength("The quick brown fox jumped over the lazy dog") === "number", "<code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return a number.");'
- text: <code>findLongestWordLength(&quot;The quick brown fox jumped over the lazy dog&quot;)</code> يجب أن يعود 6.
testString: 'assert(findLongestWordLength("The quick brown fox jumped over the lazy dog") === 6, "<code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return 6.");'
- text: <code>findLongestWordLength(&quot;May the force be with you&quot;)</code> 5.
testString: 'assert(findLongestWordLength("May the force be with you") === 5, "<code>findLongestWordLength("May the force be with you")</code> should return 5.");'
- text: <code>findLongestWordLength(&quot;Google do a barrel roll&quot;)</code> 6.
testString: 'assert(findLongestWordLength("Google do a barrel roll") === 6, "<code>findLongestWordLength("Google do a barrel roll")</code> should return 6.");'
- text: <code>findLongestWordLength(&quot;What is the average airspeed velocity of an unladen swallow&quot;)</code> 8.
testString: 'assert(findLongestWordLength("What is the average airspeed velocity of an unladen swallow") === 8, "<code>findLongestWordLength("What is the average airspeed velocity of an unladen swallow")</code> should return 8.");'
- text: <code>findLongestWordLength(&quot;What if we try a super-long word such as otorhinolaryngology&quot;)</code> يجب أن ترجع 19.
testString: 'assert(findLongestWordLength("What if we try a super-long word such as otorhinolaryngology") === 19, "<code>findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")</code> should return 19.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function findLongestWordLength(str) {
return str.length;
}
findLongestWordLength("The quick brown fox jumped over the lazy dog");
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: a6e40f1041b06c996f7b2406
title: Finders Keepers
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: من يجد شيئا يحتفظ به
---
## Description
<section id="description"> إنشاء دالة تبحث خلال صفيف (الوسيطة الأولى) وإرجاع العنصر الأول في الصفيف الذي يمرر اختبار الحقيقة (الوسيطة الثانية). إذا لم يجتاز أي عنصر الاختبار ، فارجع غير معروف. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. حاول إقران البرنامج. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })</code> يجب أن ترجع 8.'
testString: 'assert.strictEqual(findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8, "<code>findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })</code> should return 8.");'
- text: '<code>findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })</code> يجب أن تُرجع غير معرفة.'
testString: 'assert.strictEqual(findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined, "<code>findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })</code> should return undefined.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function findElement(arr, func) {
let num = 0;
return num;
}
findElement([1, 2, 3, 4], num => num % 2 === 0);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,71 @@
---
id: af2170cad53daa0770fabdea
title: Mutations
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: الطفرات
---
## Description
<section id="description"> إرجاع true إذا احتوت السلسلة في العنصر الأول من المصفوفة على كافة أحرف السلسلة في العنصر الثاني من الصفيف. على سبيل المثال ، يجب أن تعود <code>[&quot;hello&quot;, &quot;Hello&quot;]</code> ، true لأن كافة الأحرف الموجودة في السلسلة الثانية موجودة في الحالة الأولى ، مع تجاهل الحالة. يجب أن ترجع الوسيطة <code>[&quot;hello&quot;, &quot;hey&quot;]</code> false لأن السلسلة &quot;hello&quot; لا تحتوي على &quot;y&quot;. وأخيرًا ، يجب أن تعود <code>[&quot;Alien&quot;, &quot;line&quot;]</code> ، إلى true لأن جميع الأحرف في &quot;line&quot; موجودة في &quot;Alien&quot;. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: 'يجب أن تعود <code>mutation([&quot;hello&quot;, &quot;hey&quot;])</code> false.'
testString: 'assert(mutation(["hello", "hey"]) === false, "<code>mutation(["hello", "hey"])</code> should return false.");'
- text: 'يجب أن تعود <code>mutation([&quot;hello&quot;, &quot;Hello&quot;])</code> true.'
testString: 'assert(mutation(["hello", "Hello"]) === true, "<code>mutation(["hello", "Hello"])</code> should return true.");'
- text: 'يجب أن ترجع <code>mutation([&quot;zyxwvutsrqponmlkjihgfedcba&quot;, &quot;qrstu&quot;])</code> صحيح.'
testString: 'assert(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) === true, "<code>mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])</code> should return true.");'
- text: 'يجب أن تعود <code>mutation([&quot;Mary&quot;, &quot;Army&quot;])</code> الحقيقة.'
testString: 'assert(mutation(["Mary", "Army"]) === true, "<code>mutation(["Mary", "Army"])</code> should return true.");'
- text: 'يجب أن تعود <code>mutation([&quot;Mary&quot;, &quot;Aarmy&quot;])</code> true.'
testString: 'assert(mutation(["Mary", "Aarmy"]) === true, "<code>mutation(["Mary", "Aarmy"])</code> should return true.");'
- text: 'يجب أن تعود <code>mutation([&quot;Alien&quot;, &quot;line&quot;])</code> true.'
testString: 'assert(mutation(["Alien", "line"]) === true, "<code>mutation(["Alien", "line"])</code> should return true.");'
- text: 'يجب أن تعود <code>mutation([&quot;floor&quot;, &quot;for&quot;])</code> true.'
testString: 'assert(mutation(["floor", "for"]) === true, "<code>mutation(["floor", "for"])</code> should return true.");'
- text: 'يجب أن تعود <code>mutation([&quot;hello&quot;, &quot;neo&quot;])</code> false.'
testString: 'assert(mutation(["hello", "neo"]) === false, "<code>mutation(["hello", "neo"])</code> should return false.");'
- text: 'يجب أن تعود <code>mutation([&quot;voodoo&quot;, &quot;no&quot;])</code> كاذبة.'
testString: 'assert(mutation(["voodoo", "no"]) === false, "<code>mutation(["voodoo", "no"])</code> should return false.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function mutation(arr) {
return arr;
}
mutation(["hello", "hey"]);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,68 @@
---
id: afcc8d540bea9ea2669306b6
title: Repeat a String Repeat a String
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: كرر سلسلة يكرر سلسلة
---
## Description
<section id="description"> كرر <code>str</code> سلسلة معينة (الوسيطة الأولى) لـ <code>num</code> times (الوسيطة الثانية). إرجاع سلسلة فارغة إذا لم تكن <code>num</code> رقم موجب. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: 'يجب أن ترجع <code>repeatStringNumTimes(&quot;*&quot;, 3)</code> <code>&quot;***&quot;</code> .'
testString: 'assert(repeatStringNumTimes("*", 3) === "***", "<code>repeatStringNumTimes("*", 3)</code> should return <code>"***"</code>.");'
- text: 'يجب أن ترجع <code>repeatStringNumTimes(&quot;abc&quot;, 3)</code> <code>&quot;abcabcabc&quot;</code> .'
testString: 'assert(repeatStringNumTimes("abc", 3) === "abcabcabc", "<code>repeatStringNumTimes("abc", 3)</code> should return <code>"abcabcabc"</code>.");'
- text: 'يجب أن ترجع <code>repeatStringNumTimes(&quot;abc&quot;, 4)</code> <code>&quot;abcabcabcabc&quot;</code> .'
testString: 'assert(repeatStringNumTimes("abc", 4) === "abcabcabcabc", "<code>repeatStringNumTimes("abc", 4)</code> should return <code>"abcabcabcabc"</code>.");'
- text: 'يجب أن ترجع <code>repeatStringNumTimes(&quot;abc&quot;, 1)</code> <code>&quot;abc&quot;</code> .'
testString: 'assert(repeatStringNumTimes("abc", 1) === "abc", "<code>repeatStringNumTimes("abc", 1)</code> should return <code>"abc"</code>.");'
- text: 'يجب أن ترجع <code>repeatStringNumTimes(&quot;*&quot;, 8)</code> <code>&quot;********&quot;</code> .'
testString: 'assert(repeatStringNumTimes("*", 8) === "********", "<code>repeatStringNumTimes("*", 8)</code> should return <code>"********"</code>.");'
- text: 'يجب أن ترجع <code>repeatStringNumTimes(&quot;abc&quot;, -2)</code> <code>&quot;&quot;</code> .'
testString: 'assert(repeatStringNumTimes("abc", -2) === "", "<code>repeatStringNumTimes("abc", -2)</code> should return <code>""</code>.");'
- text: لا يجب استخدام <code>repeat()</code> المدمج <code>repeat()</code> -method
testString: 'assert(!/\.repeat/g.test(code), "The built-in <code>repeat()</code>-method should not be used");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function repeatStringNumTimes(str, num) {
// repeat after me
return str;
}
repeatStringNumTimes("abc", 3);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,62 @@
---
id: a789b3483989747d63b0e427
title: Return Largest Numbers in Arrays
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: أكبر عدد من المصفوفات في المصفوفة
---
## Description
<section id="description"> قم بإرجاع صفيف يتكون من أكبر رقم من كل صفيف فرعي. بالنسبة إلى البساطة ، سيحتوي الصفيف الذي تم توفيره على 4 صفيف فرعي تمامًا. تذكر ، يمكنك التكرار من خلال صفيف مع حلقة بسيطة ، والوصول إلى كل عضو مع <code>arr[i]</code> جملة <code>arr[i]</code> . تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> بإرجاع صفيف.'
testString: 'assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array, "<code>largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return an array.");'
- text: '<code>largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> يجب أن تعود <code>[27, 5, 39, 1001]</code> .'
testString: 'assert.deepEqual(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]), [27, 5, 39, 1001], "<code>largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return <code>[27, 5, 39, 1001]</code>.");'
- text: '<code>largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])</code> يجب أن تعود <code>[9, 35, 97, 1000000]</code> .'
testString: 'assert.deepEqual(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]), [9, 35, 97, 1000000], "<code>largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])</code> should return <code>[9, 35, 97, 1000000]</code>.");'
- text: '<code>largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])</code> should should return <code>[25, 48, 21, -3]</code> .'
testString: 'assert.deepEqual(largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]), [25, 48, 21, -3], "<code>largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])</code> should return <code>[25, 48, 21, -3]</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function largestOfFour(arr) {
// You can do this!
return arr;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: a202eed8fc186c8434cb6d61
title: Reverse a String
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: عكس سلسلة
---
## Description
<section id="description"> عكس السلسلة المقدمة. قد تحتاج إلى تحويل السلسلة إلى مصفوفة قبل أن تتمكن من عكسها. يجب أن تكون النتيجة الخاصة بك سلسلة. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
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>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function reverseString(str) {
return str;
}
reverseString("hello");
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,75 @@
---
id: 579e2a2c335b9d72dd32e05c
title: Slice and Splice
isRequired: true
isBeta: true
challengeType: 5
videoUrl: ''
localeTitle: شريحة و لصق
---
## Description
<section id="description"> يتم منحك صفيفين ومؤشر. استخدم <code>slice</code> الطرق <code>splice</code> لنسخ كل عنصر من المصفوفة الأولى في المصفوفة الثانية ، بالترتيب. ابدأ بإدخال عناصر في الفهرس <code>n</code> للمصفوفة الثانية. إرجاع الصفيف الناتج. يجب أن تظل صفائف الإدخال كما هي بعد تشغيل الدالة. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>frankenSplice([1, 2, 3], [4, 5], 1)</code> يجب أن ترجع <code>[4, 1, 2, 3, 5]</code> .'
testString: 'assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5], "<code>frankenSplice([1, 2, 3], [4, 5], 1)</code> should return <code>[4, 1, 2, 3, 5]</code>.");'
- text: '<code>frankenSplice([1, 2], [&quot;a&quot;, &quot;b&quot;], 1)</code> يجب أن ترجع <code>[&quot;a&quot;, 1, 2, &quot;b&quot;]</code> .'
testString: 'assert.deepEqual(frankenSplice(testArr1, testArr2, 1), ["a", 1, 2, "b"], "<code>frankenSplice([1, 2], ["a", "b"], 1)</code> should return <code>["a", 1, 2, "b"]</code>.");'
- text: '<code>frankenSplice([&quot;claw&quot;, &quot;tentacle&quot;], [&quot;head&quot;, &quot;shoulders&quot;, &quot;knees&quot;, &quot;toes&quot;], 2)</code> يجب أن تعود <code>[&quot;head&quot;, &quot;shoulders&quot;, &quot;claw&quot;, &quot;tentacle&quot;, &quot;knees&quot;, &quot;toes&quot;]</code> .'
testString: 'assert.deepEqual(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2), ["head", "shoulders", "claw", "tentacle", "knees", "toes"], "<code>frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)</code> should return <code>["head", "shoulders", "claw", "tentacle", "knees", "toes"]</code>.");'
- text: يجب إضافة جميع العناصر من الصفيف الأول إلى المصفوفة الثانية بترتيبها الأصلي.
testString: 'assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4], "All elements from the first array should be added to the second array in their original order.");'
- text: يجب أن يظل الصفيف الأول كما هو بعد تشغيل الدالة.
testString: 'assert(testArr1[0] === 1 && testArr1[1] === 2, "The first array should remain the same after the function runs.");'
- text: يجب أن يظل الصفيف الثاني كما هو بعد تشغيل الدالة.
testString: 'assert(testArr2[0] === "a" && testArr2[1] === "b", "The second array should remain the same after the function runs.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function frankenSplice(arr1, arr2, n) {
// It's alive. It's alive!
return arr2;
}
frankenSplice([1, 2, 3], [4, 5, 6], 1);
```
</div>
### After Test
<div id='js-teardown'>
```js
console.info('after the test');
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: ab6137d4e35944e21037b769
title: Title Case a Sentence
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: العنوان حالة الجملة
---
## Description
<section id="description"> قم بإرجاع السلسلة المتوفرة بالحرف الأول من كل كلمة بالأحرف الكبيرة. تأكد من أن بقية الكلمة في حالة الأحرف الصغيرة. لأغراض هذا التمرين ، يجب أيضًا تكبير الحروف الموصولة مثل &quot;the&quot; و &quot;of&quot;. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>titleCase(&quot;I&#39;m a little tea pot&quot;)</code> سلسلة.'
testString: 'assert(typeof titleCase("I"m a little tea pot") === "string", "<code>titleCase("I&#39;m a little tea pot")</code> should return a string.");'
- text: '<code>titleCase(&quot;I&#39;m a little tea pot&quot;)</code> يجب أن أعود <code>I&#39;m A Little Tea Pot</code> .'
testString: 'assert(titleCase("I"m a little tea pot") === "I"m A Little Tea Pot", "<code>titleCase("I&#39;m a little tea pot")</code> should return <code>I&#39;m A Little Tea Pot</code>.");'
- text: يجب أن ترجع <code>titleCase(&quot;sHoRt AnD sToUt&quot;)</code> <code>Short And Stout</code> .
testString: 'assert(titleCase("sHoRt AnD sToUt") === "Short And Stout", "<code>titleCase("sHoRt AnD sToUt")</code> should return <code>Short And Stout</code>.");'
- text: <code>titleCase(&quot;HERE IS MY HANDLE HERE IS MY SPOUT&quot;)</code> <code>Here Is My Handle Here Is My Spout</code> <code>titleCase(&quot;HERE IS MY HANDLE HERE IS MY SPOUT&quot;)</code> يجب أن يعود <code>Here Is My Handle Here Is My Spout</code> .
testString: 'assert(titleCase("HERE IS MY HANDLE HERE IS MY SPOUT") === "Here Is My Handle Here Is My Spout", "<code>titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")</code> should return <code>Here Is My Handle Here Is My Spout</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function titleCase(str) {
return str;
}
titleCase("I'm a little tea pot");
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,66 @@
---
id: ac6993d51946422351508a41
title: Truncate a String
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: اقتطاع سلسلة
---
## Description
<section id="description"> اقتطاع سلسلة (الوسيطة الأولى) إذا كانت أطول من طول السلسلة الأقصى المحدد (الوسيطة الثانية). إرجاع السلسلة المقتطعة مع <code>...</code> إنهاء. تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>truncateString(&quot;A-tisket a-tasket A green and yellow basket&quot;, 8)</code> يجب أن ترجع &quot;A-tisket ...&quot;.'
testString: 'assert(truncateString("A-tisket a-tasket A green and yellow basket", 8) === "A-tisket...", "<code>truncateString("A-tisket a-tasket A green and yellow basket", 8)</code> should return "A-tisket...".");'
- text: '<code>truncateString(&quot;Peter Piper picked a peck of pickled peppers&quot;, 11)</code> يجب أن ترجع &quot;بيتر بايبر ...&quot;.'
testString: 'assert(truncateString("Peter Piper picked a peck of pickled peppers", 11) === "Peter Piper...", "<code>truncateString("Peter Piper picked a peck of pickled peppers", 11)</code> should return "Peter Piper...".");'
- text: '<code>truncateString(&quot;A-tisket a-tasket A green and yellow basket&quot;, &quot;A-tisket a-tasket A green and yellow basket&quot;.length)</code> يجب أن تعود <code>truncateString(&quot;A-tisket a-tasket A green and yellow basket&quot;, &quot;A-tisket a-tasket A green and yellow basket&quot;.length)</code> &quot;A-tisket a-tasket سلة خضراء وصفراء&quot;.'
testString: 'assert(truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length) === "A-tisket a-tasket A green and yellow basket", "<code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)</code> should return "A-tisket a-tasket A green and yellow basket".");'
- text: '<code>truncateString(&quot;A-tisket a-tasket A green and yellow basket&quot;, &quot;A-tisket a-tasket A green and yellow basket&quot;.length + 2)</code> يجب أن تعود <code>truncateString(&quot;A-tisket a-tasket A green and yellow basket&quot;, &quot;A-tisket a-tasket A green and yellow basket&quot;.length + 2)</code> &quot;A-tisket a-tasket سلة خضراء وصفراء&quot;.'
testString: 'assert(truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2) === "A-tisket a-tasket A green and yellow basket", "<code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)</code> should return "A-tisket a-tasket A green and yellow basket".");'
- text: 'يجب أن ترجع <code>truncateString(&quot;A-&quot;, 1)</code> &quot;A ...&quot;.'
testString: 'assert(truncateString("A-", 1) === "A...", "<code>truncateString("A-", 1)</code> should return "A...".");'
- text: 'يجب أن ترجع <code>truncateString(&quot;Absolutely Longer&quot;, 2)</code> &quot;Ab ...&quot;.'
testString: 'assert(truncateString("Absolutely Longer", 2) === "Ab...", "<code>truncateString("Absolutely Longer", 2)</code> should return "Ab...".");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function truncateString(str, num) {
// Clear out that junk in your trunk
return str;
}
truncateString("A-tisket a-tasket A green and yellow basket", 8);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,86 @@
---
id: a24c1a4622e3c05097f71d67
title: Where do I Belong
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: إلى أين أنتمي
---
## Description
<section id="description"> قم بإرجاع أدنى مؤشر يتم فيه إدراج قيمة (وسيطة ثانية) في صفيف (وسيطة أولى) بمجرد فرزها. يجب أن تكون القيمة التي تم إرجاعها رقمًا. على سبيل المثال ، يجب أن تقوم <code>getIndexToIns([1,2,3,4], 1.5)</code> بإرجاع <code>1</code> لأنه أكبر من <code>1</code> (index 0) ، ولكن أقل من <code>2</code> (index 1). وبالمثل ، يجب أن تعود <code>getIndexToIns([20,3,5], 19)</code> <code>2</code> لأنه بمجرد فرز المصفوفة ستبدو مثل <code>[3,5,20]</code> و <code>19</code> أقل من <code>20</code> (مؤشر 2) وأكبر من <code>5</code> ( مؤشر 1). تذكر استخدام <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask</a> إذا واجهتك مشكلة. اكتب الكود الخاص بك. </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> <code>3</code> .'
testString: 'assert(getIndexToIns([10, 20, 30, 40, 50], 35) === 3, "<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return <code>3</code>.");'
- text: '<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> بإرجاع رقم.'
testString: 'assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 35)) === "number", "<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return a number.");'
- text: '<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> <code>2</code> .'
testString: 'assert(getIndexToIns([10, 20, 30, 40, 50], 30) === 2, "<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return <code>2</code>.");'
- text: '<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> بإرجاع رقم.'
testString: 'assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 30)) === "number", "<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return a number.");'
- text: 'يجب أن تعود <code>getIndexToIns([40, 60], 50)</code> <code>1</code> .'
testString: 'assert(getIndexToIns([40, 60], 50) === 1, "<code>getIndexToIns([40, 60], 50)</code> should return <code>1</code>.");'
- text: '<code>getIndexToIns([40, 60], 50)</code> بإرجاع رقم.'
testString: 'assert(typeof(getIndexToIns([40, 60], 50)) === "number", "<code>getIndexToIns([40, 60], 50)</code> should return a number.");'
- text: '<code>getIndexToIns([3, 10, 5], 3)</code> <code>0</code> .'
testString: 'assert(getIndexToIns([3, 10, 5], 3) === 0, "<code>getIndexToIns([3, 10, 5], 3)</code> should return <code>0</code>.");'
- text: '<code>getIndexToIns([3, 10, 5], 3)</code> بإرجاع رقم.'
testString: 'assert(typeof(getIndexToIns([3, 10, 5], 3)) === "number", "<code>getIndexToIns([3, 10, 5], 3)</code> should return a number.");'
- text: '<code>getIndexToIns([5, 3, 20, 3], 5)</code> <code>2</code> .'
testString: 'assert(getIndexToIns([5, 3, 20, 3], 5) === 2, "<code>getIndexToIns([5, 3, 20, 3], 5)</code> should return <code>2</code>.");'
- text: '<code>getIndexToIns([5, 3, 20, 3], 5)</code> بإرجاع رقم.'
testString: 'assert(typeof(getIndexToIns([5, 3, 20, 3], 5)) === "number", "<code>getIndexToIns([5, 3, 20, 3], 5)</code> should return a number.");'
- text: '<code>getIndexToIns([2, 20, 10], 19)</code> <code>2</code> .'
testString: 'assert(getIndexToIns([2, 20, 10], 19) === 2, "<code>getIndexToIns([2, 20, 10], 19)</code> should return <code>2</code>.");'
- text: '<code>getIndexToIns([2, 20, 10], 19)</code> بإرجاع رقم.'
testString: 'assert(typeof(getIndexToIns([2, 20, 10], 19)) === "number", "<code>getIndexToIns([2, 20, 10], 19)</code> should return a number.");'
- text: '<code>getIndexToIns([2, 5, 10], 15)</code> <code>3</code> .'
testString: 'assert(getIndexToIns([2, 5, 10], 15) === 3, "<code>getIndexToIns([2, 5, 10], 15)</code> should return <code>3</code>.");'
- text: '<code>getIndexToIns([2, 5, 10], 15)</code> بإرجاع رقم.'
testString: 'assert(typeof(getIndexToIns([2, 5, 10], 15)) === "number", "<code>getIndexToIns([2, 5, 10], 15)</code> should return a number.");'
- text: 'يجب أن ترجع <code>getIndexToIns([], 1)</code> <code>0</code> .'
testString: 'assert(getIndexToIns([], 1) === 0, "<code>getIndexToIns([], 1)</code> should return <code>0</code>.");'
- text: '<code>getIndexToIns([], 1)</code> بإرجاع رقم.'
testString: 'assert(typeof(getIndexToIns([], 1)) === "number", "<code>getIndexToIns([], 1)</code> should return a number.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function getIndexToIns(arr, num) {
// Find my place in this sorted array.
return num;
}
getIndexToIns([40, 60], 50);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>