added answers

This commit is contained in:
Jared Ramon Elizan 2022-07-15 09:00:24 +08:00
parent f529df4e26
commit 5b8f2c93c8
1 changed files with 6 additions and 11 deletions

View File

@ -1,13 +1,8 @@
const removeFromArray = function(arr, remove) { const removeFromArray = function(...args) {
if(arr.includes(remove)){ const array = args[0];
let removedValue = arr.splice(arr[remove] - 2, 1); return array .filter( val => !args.includes(val));
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;