
array.splice() – Adds/Removes elements **in place** and returns the removed elements.
๐ Syntax
removed = array.splice(start, deleteCount, item1, ...);
๐งช Example
const a=[1,2,3]; a.splice(1,1,'B'); // a=[1,'B',3]
array.splice() – Adds/Removes elements **in place** and returns the removed elements.
removed = array.splice(start, deleteCount, item1, ...);
const a=[1,2,3]; a.splice(1,1,'B'); // a=[1,'B',3]
Comments
Post a Comment