--- id: 579e2a2c335b9d72dd32e05c title: Slice and Splice isRequired: true isBeta: true challengeType: 5 videoUrl: '' localeTitle: شريحة و لصق --- ## Description
يتم منحك صفيفين ومؤشر. استخدم slice الطرق splice لنسخ كل عنصر من المصفوفة الأولى في المصفوفة الثانية ، بالترتيب. ابدأ بإدخال عناصر في الفهرس n للمصفوفة الثانية. إرجاع الصفيف الناتج. يجب أن تظل صفائف الإدخال كما هي بعد تشغيل الدالة. تذكر استخدام Read-Search-Ask إذا واجهتك مشكلة. اكتب الكود الخاص بك.
## Instructions
## Tests
```yml tests: - text: 'frankenSplice([1, 2, 3], [4, 5], 1) يجب أن ترجع [4, 1, 2, 3, 5] .' testString: 'assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5], "frankenSplice([1, 2, 3], [4, 5], 1) should return [4, 1, 2, 3, 5].");' - text: 'frankenSplice([1, 2], ["a", "b"], 1) يجب أن ترجع ["a", 1, 2, "b"] .' testString: 'assert.deepEqual(frankenSplice(testArr1, testArr2, 1), ["a", 1, 2, "b"], "frankenSplice([1, 2], ["a", "b"], 1) should return ["a", 1, 2, "b"].");' - text: 'frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2) يجب أن تعود ["head", "shoulders", "claw", "tentacle", "knees", "toes"] .' testString: 'assert.deepEqual(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2), ["head", "shoulders", "claw", "tentacle", "knees", "toes"], "frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2) should return ["head", "shoulders", "claw", "tentacle", "knees", "toes"].");' - 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.");' ```
## Challenge Seed
```js function frankenSplice(arr1, arr2, n) { // It's alive. It's alive! return arr2; } frankenSplice([1, 2, 3], [4, 5, 6], 1); ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```