Slice and Splice - what's wrong here

Though I know how to solve this with the for loop I avoided it and wanted to know what’s wrong with the solution I coded.

Appreciate any feedback.

function frankenSplice(arr1, arr2, n) {
  let i;
  Number.isInteger(n) ? i = n : i = arr2.indexOf(n);
  let arr3 = arr2.slice();
  return arr3;
console.log(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0.

Link to the challenge:

You need to return a one-dimensional array. You are currently injecting an array as an element into another array, resulting in a 2D array:

1 Like

Thanks Ariel, saw it almost the same time you replied a few days back. :slight_smile: