--- id: a3f503de51cf954ede28891d title: Find the Symmetric Difference challengeType: 5 videoUrl: '' localeTitle: Encuentra la diferencia simétrica --- ## Description
Cree una función que tome dos o más matrices y devuelva una matriz de la diferencia simétrica ( o ) de las matrices proporcionadas. Dados dos conjuntos (por ejemplo, conjunto A = {1, 2, 3} y conjunto B = {2, 3, 4} ), el término matemático "diferencia simétrica" ​​es el conjunto de elementos que se encuentran en cualquiera de los dos conjuntos, pero no en ambos ( A △ B = C = {1, 4} ). Por cada diferencia simétrica adicional que tome (por ejemplo, en un conjunto D = {2, 3} ), debe obtener el conjunto con elementos que están en cualquiera de los dos conjuntos pero no en ambos ( C △ D = {1, 4} △ {2, 3} = {1, 2, 3, 4} ). La matriz resultante debe contener solo valores únicos ( no duplicados ). Recuerda usar Read-Search-Ask si te atascas. Trate de emparejar el programa. Escribe tu propio código.
## Instructions
## Tests
```yml tests: - text: 'sym([1, 2, 3], [5, 2, 1, 4]) debe devolver [3, 4, 5] .' testString: 'assert.sameMembers(sym([1, 2, 3], [5, 2, 1, 4]), [3, 4, 5], "sym([1, 2, 3], [5, 2, 1, 4]) should return [3, 4, 5].");' - text: 'sym([1, 2, 3], [5, 2, 1, 4]) debe contener solo tres elementos.' testString: 'assert.equal(sym([1, 2, 3], [5, 2, 1, 4]).length, 3, "sym([1, 2, 3], [5, 2, 1, 4]) should contain only three elements.");' - text: 'sym([1, 2, 3, 3], [5, 2, 1, 4]) debe devolver [3, 4, 5] .' testString: 'assert.sameMembers(sym([1, 2, 3, 3], [5, 2, 1, 4]), [3, 4, 5], "sym([1, 2, 3, 3], [5, 2, 1, 4]) should return [3, 4, 5].");' - text: 'sym([1, 2, 3, 3], [5, 2, 1, 4]) debe contener solo tres elementos.' testString: 'assert.equal(sym([1, 2, 3, 3], [5, 2, 1, 4]).length, 3, "sym([1, 2, 3, 3], [5, 2, 1, 4]) should contain only three elements.");' - text: 'sym([1, 2, 3], [5, 2, 1, 4, 5]) debe devolver [3, 4, 5] .' testString: 'assert.sameMembers(sym([1, 2, 3], [5, 2, 1, 4, 5]), [3, 4, 5], "sym([1, 2, 3], [5, 2, 1, 4, 5]) should return [3, 4, 5].");' - text: 'sym([1, 2, 3], [5, 2, 1, 4, 5]) debe contener solo tres elementos.' testString: 'assert.equal(sym([1, 2, 3], [5, 2, 1, 4, 5]).length, 3, "sym([1, 2, 3], [5, 2, 1, 4, 5]) should contain only three elements.");' - text: 'sym([1, 2, 5], [2, 3, 5], [3, 4, 5]) debe devolver [1, 4, 5]' testString: 'assert.sameMembers(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]), [1, 4, 5], "sym([1, 2, 5], [2, 3, 5], [3, 4, 5]) should return [1, 4, 5]");' - text: 'sym([1, 2, 5], [2, 3, 5], [3, 4, 5]) debe contener solo tres elementos.' testString: 'assert.equal(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]).length, 3, "sym([1, 2, 5], [2, 3, 5], [3, 4, 5]) should contain only three elements.");' - text: 'sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]) debe devolver [1, 4, 5] .' testString: 'assert.sameMembers(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]), [1, 4, 5], "sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]) should return [1, 4, 5].");' - text: 'sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]) debe contener solo tres elementos.' testString: 'assert.equal(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]).length, 3, "sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]) should contain only three elements.");' - text: 'sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3]) debe devolver [2, 3, 4, 6, 7] .' testString: 'assert.sameMembers(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3]), [2, 3, 4, 6, 7], "sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3]) should return [2, 3, 4, 6, 7].");' - text: 'sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3]) debe contener solo cinco elementos.' testString: 'assert.equal(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3]).length, 5, "sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3]) should contain only five elements.");' - text: 'sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]) debe devolver [1, 2, 4, 5, 6, 7, 8, 9] .' testString: 'assert.sameMembers(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]), [1, 2, 4, 5, 6, 7, 8, 9], "sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]) should return [1, 2, 4, 5, 6, 7, 8, 9].");' - text: 'sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]) debe contener solo ocho elementos.' testString: 'assert.equal(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]).length, 8, "sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]) should contain only eight elements.");' ```
## Challenge Seed
```js function sym(args) { return args; } sym([1, 2, 3], [5, 2, 1, 4]); ```
## Solution
```js // solution required ```