프로그램/script

javascript : Array.prototype.slice and splice

mulderu 2018. 1. 25. 17:45


Array.prototype.slice and splice


자주 안써서 햇갈릴수 있는 함수.... ^^



slice : The slice() method returns a shallow copy of a portion of an array into a new array object selected from begin to end (end not included). The original array will not be modified.


splice :  The splice() method changes the contents of an array by removing existing elements and/or adding new elements

               original array was modified...

-----------------------------------------------------------------