Remove element from Array Javascript
-----------------------------------------------------------------------
const array = ["test1", "test2", "test3", "test4"];
console.log(array);
const index = array.indexOf("test2");
if (index > -1) {
array.splice(index, 1);
}
// **** array = ["test1", "test3", "test4"]
console.log(array);
Comments
Post a Comment