Skip to content

Commit cd50889

Browse files
Merge pull request ryanmcdermott#65 from vsemozhetbyt/simplify
Simplify some code examples
2 parents 0860146 + d279012 commit cd50889

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

README.md

+1-14
Original file line numberDiff line numberDiff line change
@@ -585,20 +585,7 @@ Array.prototype.diff = function diff(comparisonArray) {
585585
```javascript
586586
class SuperArray extends Array {
587587
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;
588+
return this.filter(elem => !comparisonArray.includes(elem));
602589
}
603590
}
604591
```

0 commit comments

Comments
 (0)