Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove element from array javascript

let fruit = ['apple', 'banana', 'orange', 'lettuce']; 
// ^^ An example array that needs to have one item removed

fruit.splice(3, 1); // Removes an item in the array using splice() method
// First argument is the index of removal
// Second argument is the amount of items to remove from that index and on

Source by love2dev.com #
 
PREVIOUS NEXT
Tagged: #remove #element #array #javascript
ADD COMMENT
Topic
Name
9+7 =