How can I remove a specific item from an array Kahnu Help July 19, 2022 express js 0 Comments const array = [2, 5, 9];console.log(array);const index = array.indexOf(9);if (index > -1) { // only splice array when item is found array.splice(index, 1); // 2nd parameter means remove one item only}// array = [2, 9]console.log(array); Tags express js javascript next js node
0 Comments
Post a Comment