# Slice and Splice code not being accepted

**URL:** <https://forum.freecodecamp.org/t/slice-and-splice-code-not-being-accepted/303826>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [August 8, 2019, 11:41pm UTC](https://forum.freecodecamp.org/t/slice-and-splice-code-not-being-accepted/303826 "2019-08-08T23:41:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fnicoletta](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fnicoletta](https://forum.freecodecamp.org/u/fnicoletta)\
**Post date:** [August 8, 2019, 11:41pm UTC](https://forum.freecodecamp.org/t/slice-and-splice-code-not-being-accepted/303826/1 "2019-08-08T23:41:19Z")

</div>

**Tell us what’s happening:**  
For some reason the website is not accepting my code, but when i `console.log(arr3);` it seems that it is working fine. Is there something wrong with it that I am not seeing?

**Your code so far**

```js

function frankenSplice(arr1, arr2, n) {
  // It's alive. It's alive!
  const arr3 = arr2.slice();
  return arr3.splice(n, 0, arr1);
}

frankenSplice([1, 2], ['a', 'b'], 1);

```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36`.

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![camperextraordinaire](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@camperextraordinaire](https://forum.freecodecamp.org/u/camperextraordinaire)\
**Post date:** [August 8, 2019, 11:53pm UTC](https://forum.freecodecamp.org/t/slice-and-splice-code-not-being-accepted/303826/2 "2019-08-08T23:53:11Z")

</div>

You have inserted arr1 into the position n instead of the elements of arr1. Also, splice returns an array of values removed, which in this case is an empty array. You want to return arr3 after the splice has taken place.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 25, 2021, 12:23pm UTC](https://forum.freecodecamp.org/t/slice-and-splice-code-not-being-accepted/303826/3 "2021-01-25T12:23:24Z")

</div>


