initial commit
This commit is contained in:
parent
cb52b89d98
commit
f529df4e26
|
@ -1,6 +1,13 @@
|
||||||
const removeFromArray = function(arr, remove) {
|
const removeFromArray = function(arr, remove) {
|
||||||
|
if(arr.includes(remove)){
|
||||||
|
let removedValue = arr.splice(arr[remove] - 2, 1);
|
||||||
|
let clean = arr.filter(( para ) => {
|
||||||
|
return para != removedValue;
|
||||||
|
});
|
||||||
|
return clean;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
};
|
console.log(removeFromArray([1,2,3,4], 3));
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
module.exports = removeFromArray;
|
module.exports = removeFromArray;
|
||||||
|
|
Loading…
Reference in New Issue