Sobes.tech
Junior — Senior

Removing from the first array all elements present in the second

livecode

Task condition

It is necessary to implement a function that takes two arrays and removes from the first array all elements that are present in the second array, while preserving the order of the remaining elements.

// Examples:
console.log(function([0, 2, 2, 2, 4], [2]));        // [0, 4]
console.log(function([1, 2, 2], [1]));              // [2, 2]
console.log(function([0, 2, 3], [1, 2]));           // [0, 3]