Answers for "javascript to remove few items from array"

1

js remove several elements from array

var ar = ['zero', 'one', 'two', 'three'];ar.shift(); // returns "zero"console.log( ar ); // ["one", "two", "three"]
Posted by: Guest on July-10-2020
0

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));
Posted by: Guest on November-25-2020
-1

js remove several elements from array

var arr1 = [1, 2, 3, 4, 5, 6];var arr2 = arr1; // Reference arr1 by another variable arr1 = [];console.log(arr2); // Output [1, 2, 3, 4, 5, 6]
Posted by: Guest on July-10-2020

Code answers related to "javascript to remove few items from array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language