Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript to remove few items from array

const nums = [1, 2, 3, 4, 5, 6];
const remove = [1, 2, 4, 6];

function removeFromArray(original, remove) {
  return original.filter(value => !remove.includes(value));
}

console.log(removeFromArray(nums, remove));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #remove #items #array
ADD COMMENT
Topic
Name
5+1 =