Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7035841 commit 14e83d5Copy full SHA for 14e83d5
README.md
@@ -624,20 +624,7 @@ Array.prototype.diff = function(comparisonArray) {
624
```javascript
625
class SuperArray extends Array {
626
diff(comparisonArray) {
627
- var values = [];
628
- var hash = {};
629
-
630
- for (var i of comparisonArray) {
631
- hash[i] = true;
632
- }
633
634
- for (var i of this) {
635
- if (!hash[i]) {
636
- values.push(i);
637
638
639
640
- return values;
+ return this.filter(elem => !comparisonArray.includes(elem));
641
}
642
643
```
0 commit comments