Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Slice and Splice -Javascript

function frankenSplice(arr1, arr2, n) {
  // It's alive. It's alive!
  let localArray = arr2.slice();
  for (let i = 0; i < arr1.length; i++) {
    localArray.splice(n, 0, arr1[i]);
    n++;
  }
  return localArray;
}
Source by forum.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #Slice #Splice
ADD COMMENT
Topic
Name
9+2 =