Published
- 1 min read
how to take an element out of an array in javascript
The solution for this is noted below
how to take an element out of an array in javascript
Solution
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];
Try other methods by searching on the site. That is if this doesn’t work