1var ar = ['zero', 'one', 'two', 'three'];ar.shift(); // returns "zero"console.log( ar ); // ["one", "two", "three"]
1const nums = [1, 2, 3, 4, 5, 6];
2const remove = [1, 2, 4, 6];
3
4function removeFromArray(original, remove) {
5 return original.filter(value => !remove.includes(value));
6}
7
8console.log(removeFromArray(nums, remove));
1var 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]