Symmetric difference algorithm has misleading example?

Symmetric difference algorithm has misleading example?
0

#1

Hello,

I was trying today this: https://www.freecodecamp.org/challenges/symmetric-difference with a friend, and we were both mislead by the argument args of the function. We were both thinking that it was the arguments object (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments), because of the similar name.

What about changing the signature of the function, either removing the argument, passing two arguments or just by changing the name of the variable to something a bit more distinct from arguments?

What do you think? Should I open an issue or a pull request about it?

Thanks!


#2

I think maybe it’s set that way to get you to think critically about what’s going on. If you immediately:

console.log(args)

You’ll see it doesn’t contain all the arguments that were passed to the functions. The arguments object is always called arguments so anything else is not the actual arguments object no matter how closely it may resemble it.

It also helps that two or three challenges before this, they introduce the argument objects so campers should already be familiar with what it is and how

args

does not actually point to the arguments object.

Having said all of that, I have spent many hours of frustration going through docs because of things I misunderstood about the challenges and it is quite infuriating so I understand the sentiment. Good luck on the rest of you and your friend’s coding journey!


#3

Thanks @iamknox, I see your points :slight_smile:

Probably if it wasn’t deliberate it’s still a good thing to have it that way!