1.前言
Array.prototype.slice() 数组原型上的方法
2.用法
基础用法
const animals = ['ant', 'bison', 'camel', 'duck', 'elephant'];
console.log(animals.slice(-3));
// 输出: ["camel", "duck", "elephant"]
console.log(animals.slice(2, 4));
// 输出: ["camel", "duck"]
console.log(animals.slice(1, 5));
// 输出: ["bison", "camel", "duck", "elephant"]
3.参数
arr.slice([begin[, end]])
4.返回值
arr.slice([begin[, end]])
// 一个含有被提取元素的新数组
5.重写