标签:bsp ice code OLE class col slice span console
slice传入一个参数时(可传负数)
var arr = [‘a‘, ‘b‘, ‘c‘, ‘d‘, ‘e‘]; var arr1 = arr.slice(1); console.log(arr) // [‘a‘, ‘b‘, ‘c‘, ‘d‘, ‘e‘] console.log(arr1) // [‘b‘, ‘c‘, ‘d‘, ‘e‘]
传入两个参数
var arr = [‘a‘, ‘b‘, ‘c‘, ‘d‘, ‘e‘]; var arr1 = arr.slice(1, 4); console.log(arr) // [‘a‘, ‘b‘, ‘c‘, ‘d‘, ‘e‘] console.log(arr1) //["b", "c", "d"]
标签:bsp ice code OLE class col slice span console
原文地址:https://www.cnblogs.com/xm16/p/10356843.html