Getting an error only with freecodecamp editor because of an iterable


I did the challenge in vs code with no errors and when I pasted in console give me this error. I cant figure it out why I’m getting this error.

const sym = (...args) => {
  const copy_args = [...args];
  let last_set = [ Set(copy_args[0])];

  for (let i = 1; i < copy_args.length; i++) {
      const current_set = [ Set(copy_args[i])];
      const joined_sets = last_set.concat(current_set);

      const duplicate_values = joined_sets.filter(
          (item, index) => joined_sets.indexOf(item) !== index

      const removed_duplicates = joined_sets.filter(
          (item) => !duplicate_values.includes(item)

      const final_set = removed_duplicates.sort((a, b) => a - b);

      last_set = final_set;

   return last_set;

console.log(sym([3, 3, 3, 2, 5], [2, 1, 5, 7]));

Error in freecodecamp editor → TypeError: number 1 is not iterable (cannot read property Symbol(Symbol.iterator))

Thanks for your time

Please post your actual code and a link to the challenge. Thanks

Not getting that error when I run your code in the FCC editor or locally.

For some reason the error disappear when I removed the old function declaration( e.g function(){} ) If you ran my code without arrow function it crashes in FCC

Silly question, but is your browser up to date?

Can you show us the actual full code that crashes since the current one you posted does not?

The code wont work if you use function sym(args) { } in FCC

I tested it that way and it still passes all the tests without crashing, that is why I wanted to see the full code you were trying that crashes. You may have something slightly different.

Set is a somewhat new feature, which is why I’m asking if your browser is up to date.

No its equal, maybe occur another problem with browser. The important is that passed all tests

Maybe it bugged. Now is working