My instructor mentioned that I can resolve this issue without utilizing arguments in const args, but through the use of ...rest I'm not very comfortable with this operator so I could use some guidance on it. Please incorporate rest and provide types to all parameters.
function deleteValues(arr: number[]) {
const args = arr.slice.call(arguments,1);
function remove(toDel: number) {
return args.indexOf(toDel) === -1;
}
return arr.filter(remove);
}
const result = deleteValues([1, 2, 3, 1, 2, 3], 1, 3);
console.log(result);
(In this function, the second and any subsequent arguments remove themselves from the first argument. For example, using ([1, 2, 3, 1, 2, 3], 1, 3) would output [2, 2] after removing all instances of 1 and 3.)