Ad Unit (Iklan) BIG

what is difference between slice and splice in jquery


var list=['a','b','c','d','e'];

// array.slice(startindex, endindex-1)
console.log(list.slice(1,3));
// ["b,c"]

//array.splice(startindex, endindex(count))
console.log(list.splice(1,3));
// ["b","c","d"]

Post a Comment

0 Comments