function destroyer(arr) {
// Remove all the values
var val1=arguments[1];
var val2=arguments[2];
var val3=arguments[3];
var arrDe=arr.filter(function(val){return (val!=val1)&&(val!=val2)&&(val!=val3);});
return arrDe;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
挑战
函数里有个初始数组和几个参数,移除数组里和参数一样的元素,返回新数组。
代码
结果显示
帮助
Arguments object Array.prototype.filter()
来源
https://www.freecodecamp.org/challenges/seek-and-destroy