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) {
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));
const removeFromArray = function(...args) {
const array = args[0];
return array .filter( val => !args.includes(val));
};
// Do not edit below this line
module.exports = removeFromArray;