Is there any reason why one should be used over the other?
var arData=['a','b','c']; arData.slice(1,1);//removes 'b' var arData=['a','b','c']; delete arData;//removes 'b'
delete leaves you with
[ 'a', undefined, 'c' ]
splice leaves you with
[ 'a', 'c' ]
slice doesn't do anything to the original array :) But it returns
[ 'b' ] in your code
©2020 All rights reserved.