const arr = [1, 2, 3, 4]
1、slice: arr不变化
const arr1 = arr.slice(0, 1)
// arr1 = 1
// arr = [1, 2, 3, 4]
2、splice: arr变化
const arr1 = arr.splice(0, 1)
// arr1 = 1
// arr = [2, 3, 4]
const arr = [1, 2, 3, 4]
1、slice: arr不变化
const arr1 = arr.slice(0, 1)
// arr1 = 1
// arr = [1, 2, 3, 4]
2、splice: arr变化
const arr1 = arr.splice(0, 1)
// arr1 = 1
// arr = [2, 3, 4]