Delete redundant solution (#36393)
The first advanced solution is almost identical to the intermediate one. Per "similar but better" rule, I believe the first one should be kept (or at the bare minimum, they should at least fill the same category).
This commit is contained in:
@ -96,23 +96,6 @@ Explain solution here and add any relevant links
|
|||||||
* <a href='https://devdocs.io/javascript/global_objects/array/includes' target='_blank' rel='nofollow'>Array.prototype.includes (Devdocs)</a>
|
* <a href='https://devdocs.io/javascript/global_objects/array/includes' target='_blank' rel='nofollow'>Array.prototype.includes (Devdocs)</a>
|
||||||
|
|
||||||
##  Advanced Code Solution (Declarative Solution):
|
##  Advanced Code Solution (Declarative Solution):
|
||||||
|
|
||||||
function diffArray(arr1, arr2) {
|
|
||||||
return arr1
|
|
||||||
.filter(el => !arr2.includes(el))
|
|
||||||
.concat(
|
|
||||||
arr2.filter(el => !arr1.includes(el))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
|
|
||||||
|
|
||||||
|
|
||||||
### Code Explanation:
|
|
||||||
|
|
||||||
Explain solution here and add any relevant links
|
|
||||||
|
|
||||||
##  Advanced Code Solution Alternative (Declarative Solution):
|
|
||||||
function diffArray(arr1, arr2) {
|
function diffArray(arr1, arr2) {
|
||||||
return [
|
return [
|
||||||
...diff(arr1, arr2),
|
...diff(arr1, arr2),
|
||||||
|
Reference in New Issue
Block a user