First, the names eval and arguments can’t be bound or assigned in language syntax. All these attempts to do so are syntax errors:
'use strict';
eval = 17;
arguments++;
++eval;
var obj = { set p(arguments) { } };
var eval;
try { } catch (arguments) { }
function x(eval) { }
function arguments() { }
var y = function eval() { };
var f = new Function('arguments', "'use strict'; return 17;");
Second, strict mode code doesn’t alias properties of arguments objects created within it. In normal code within a function whose first argument is arg , setting arg also sets arguments[0] , and vice versa (unless no arguments were provided or arguments[0] is deleted). arguments objects for strict mode functions store the original arguments when the function was invoked. arguments[i] does not track the value of the corresponding named argument, nor does a named argument track the value in the corresponding arguments[i] .
function f(a) {
'use strict';
a = 42;
return [a, arguments[0]];
}
var pair = f(17);
console.assert(pair[0] === 42);
console.assert(pair[1] === 17);
Changing arguments to argumentos solves the problem:
function destroyer (lista,...argumentos){
let not_destroyed = [];
let src_list = lista;
var check = Array.prototype.slice.call(argumentos);
for (var i in lista) {
if (argumentos.includes(lista[i])==false) {
not_destroyed.push(lista[i])
}
}
return not_destroyed
}