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 21a0645 commit 17fb236Copy full SHA for 17fb236
data-structures-in-javascript/set.es6.js
@@ -20,11 +20,7 @@ class Set {
20
}
21
22
contains(value) {
23
- if(~this.values.indexOf(value)) {
24
- return true;
25
- } else {
26
- return false;
27
- }
+ return this.values.indexOf(value) !== -1;
28
29
30
union(set) {
data-structures-in-javascript/set.js
@@ -17,11 +17,7 @@ Set.prototype.remove = function(value) {
17
18
};
19
Set.prototype.contains = function(value) {
Set.prototype.union = function(set) {
var newSet = new Set();
0 commit comments