我有两个不同的数组,我想删除第二个数组中存在的第一个数组元素的所有副本。我已经尝试了一些splice和indexOf方法,但未能实现。检查了其他一些帖子,但找不到我正在寻找的东西。这是下面的示例代码。谢谢你们。
let container = [1, 2, 2, 2, 3, 3, 3, 4, 5];
let removing = [2, 3];
function func(container, removing){
let result = //i want to write a function there which will remove all duplicates of "removing" from "container".
return result; // result = [1, 4, 5]
}
Run Code Online (Sandbox Code Playgroud)