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.
2 parents 0860146 + d279012 commit cd50889Copy full SHA for cd50889
README.md
@@ -585,20 +585,7 @@ Array.prototype.diff = function diff(comparisonArray) {
585
```javascript
586
class SuperArray extends Array {
587
diff(comparisonArray) {
588
- const values = [];
589
- const hash = {};
590
-
591
- for (const i of comparisonArray) {
592
- hash[i] = true;
593
- }
594
595
- for (const i of this) {
596
- if (!hash[i]) {
597
- values.push(i);
598
599
600
601
- return values;
+ return this.filter(elem => !comparisonArray.includes(elem));
602
}
603
604
```
0 commit comments