Created code to remove a single value

This commit is contained in:
Mohammed Nabeel 2020-07-15 18:06:28 +03:00
parent 888383a44e
commit 3699f94da9
2 changed files with 34 additions and 24 deletions

View File

@ -1,4 +1,14 @@
const removeFromArray = function() {
const removeFromArray = function(...args) {
let myArray = args[0];
let pos = 0;
for (let i = 1; i < args.length; i++) {
pos = myArray.indexOf(args[i]);
myArray.splice(pos, 1);
}
return myArray;
}