Hướng dẫn thử thách
1 / 1
Build a Symmetric Difference Function
Compare two arrays and return a new array with any items only found in one of the two given arrays, but not both. In other words, return the symmetric difference of the two arrays.
Example:
- Array A: `["diamond", "stick", "apple"]`
- Array B: `["stick", "emerald", "bread"]`
Result: `["diamond", "apple", "emerald", "bread"]`
**Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. Your function `diffArray` should return an array.
2. Your function should take two arguments, both of which are arrays.
3. Your function should make use of the `filter` method.
4. Your function should return the symmetric difference of the two arrays.
5. Your function should return an empty array if there is no symmetric difference.
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.js
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵