You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
228 B
JavaScript
10 lines
228 B
JavaScript
5 years ago
|
function remove_array_element(array, n)
|
||
|
{
|
||
|
var index = array.indexOf(n);
|
||
|
if (index > -1) {
|
||
|
array.splice(index, 1);
|
||
|
}
|
||
|
return array;
|
||
|
}
|
||
|
|
||
|
console.log(remove_array_element([2, 5, 9, 6], 5));
|