Challenge Seek and Destroy has an issue.
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
function destroyer(arr,val1,val2,val3) {
// Remove all the values
//alert('sum=' + val1 +'another val2='+val2);
function identic(value){
return (value !== val1 );
}
function identic1(value){
return (value !== val2 );
}
function identic2(value){
return (value !== val3 );
}
arr = arr.filter(identic);
arr = arr.filter(identic1);
arr = arr.filter(identic2);
return arr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Your code works and it passes all the tests.
In your destroyer function you have 4 arguments and you don't need 1 of them.
arr is assigned to represent [1,2,3,1,2,3] array,
val1 is assigned to represent number 2,
and val2 is assigned to represent number 3.
val3 is undefined in this case.
You don't need val3 and it's value is undefined but it passes the assignment because you've made
a comparison value !== val3 which is true because value is not undefined and it passes the test but all in all val3 is undefined and does pretty much nothing useful in this assignment.
@Venikeee1 Your code will only work for 4 arguments max. The challenge actually wants you to create a function, which can tackle any number of arguments, other than the array, which is the first argument,
Passing this challenge in this way will no longer be possible after the next update. Please see #11235 for more details.
Maybe we can clear this up for campers by removing the arr argument in the function?
cc/ @FreeCodeCamp/issue-moderators
Shall we remove the arr argument from the function, as a gentle nudge towards the arguments object?
:+1: campers then have to do the following
var arr = arguments[0];
var restparams = [].slice.call(arguments, 1);
or that maybe pre-filled in the challenge seed for subtly making the campers think and progress the solution in this direction.
I think explicitly mentioning that you're supposed to use the arguments object would be sufficient.
Currently, the link to the MDN page is there, but campers know from challenges before that you don't always _have_ to use the content from the links. Adding this to the description could help clear up a lot of confusion while still having campers come up with the actual solution themselves.
Most helpful comment
cc/ @FreeCodeCamp/issue-moderators
Shall we remove the
arrargument from the function, as a gentle nudge towards theargumentsobject?