Slice 和 Splice


#1

Tell us what’s happening:

Your code so far


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

frankenSplice([1, 2, 3], [4, 5, 6], 1);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.one/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice


#2

答案是遍历数组一然后一个一个插入 最后 输出 而我这个是直接切片数组一和二 然后直接切片一插入切片二插入 不行吗?为什么呢


#3

呀 不好意思 题目是依次复制插入 审题不认真,我没有权限删除主题,不好意思,麻烦版主了…