const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// 5番目の要素から最後まで取り出す
const arr1 = arr.slice(5)
console.log(arr1) // [6,7,8,9,10]
// 2番目の要素から5番目の要素まで取り出す
const arr2 = arr.slice(1, 5)
console.log(arr2) // [2,3,4,5]
// 1番目の要素から2番目の要素まで取り出す
const arr3 = arr.slice(0, 2)
console.log(arr3) // [1,2]
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.