Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to take an element out of an array in javascript

var data = [1, 2, 3];

// remove a specific value
// splice(starting index, how many values to remove);
data = data.splice(1, 1);
// data = [1, 3];

// remove last element
data = data.pop();
// data = [1, 2];
 
PREVIOUS NEXT
Tagged: #element #array #javascript
ADD COMMENT
Topic
Name
4+2 =