Array.prototype.slice() 배열에서 시작과 끝을 추출하는 함수
Array.prototype.slice() slice() 메서드는 어떤 배열의 begin부터 end까지(end 미포함)에 대한 얕은 복사본을 새로운 배열 객체로 반환합니다. 원본 배열은 바뀌지 않습니다. 구문 arr.slice([begin[, end]]) 예제 const animals = ['ant', 'bison', 'camel', 'duck', 'elephant']; console.log(animals.slice(2)); // expected output: Array ["camel", "duck", "elephant"] console.log(animals.slice(1, 4)); // expected output: Array ['bison', 'camel', 'duck'] console.log(ani..
2022. 1. 15.