Why do the tests not pass if I change '...arr' to something else, such as '...somethingElse'?

Tell us what’s happening:
Why do the tests not pass if I change ‘…arr’ to something else, such as ‘…somethingElse’?
Your code so far

const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
// Only change code below this line
const [a, b, ...arr] = list;
// Only change code above this line
return arr;
const arr = removeFirstTwo(source);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36.

Challenge: Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

The more information you give us, the more likely we are to be able to help.

Are you asking about this part of the code?

// Only change code above this line
return arr;

I’m asking why if I copy the suggested solution all tests pass, but if I change ‘…arr’ to a different name instead of ‘arr’ the tests don’t pass, and instead it tells me to use destructuring. Isn’t the name given to’…arr’ irrelevant?

I’m assuming when you are changing arr to somethingElse you are doing it in both places? If so, then yes, technically this should work, but I think the FCC tests are expecting that array to be named arr and thus the test will fail if you change the name arr.

P.S. As a general rule, don’t change anything in the default code other than what is asked of you. The FCC tests can be very picky at times and even the smallest change that they are not expecting can cause the test to fail.

That’s what I figured, in which case it’s ridiculous for them to make beginners think that the code works only if you use ‘arr’ for your dummy variable.

I understand what you are saying but the default code clearly states the only place where you should change the code. Since the return statement returns an array with the name arr and you aren’t supposed to change that line then I think it goes without saying that you should use arr in the previous line.

The intent clearly is not to make beginners think there is some magic with the name arr. I think the intent is to keep things as simple as possible by removing all the little decisions that programmers have to make, such as what to name a variable. Instead, just focus on the one point the challenge is trying to teach.

Yep, you have to respect the comments or the test suite won’t work correctly. I think the challenge makes it clear that you can’t change the variable name.

  // Only change code below this line
  const arr = list; // Change this line
  // Only change code above this line
  return arr;

Sometimes you have to make more restrictive constraints in order to allow proper testing of given functionality.