Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

splice()

/"removes any number of consecutive elements from anywhere in an array."/
let array = ['today', 'was', 'not', 'so', 'great'];

array.splice(2, 2);
// remove 2 elements beginning with the 3rd element
// array now equals ['today', 'was', 'great']
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
3+9 =