-
Notifications
You must be signed in to change notification settings - Fork 0
Set #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
if(!this.set[value]) { | ||
this.set[value] = value; | ||
} else { | ||
return 'this is already here try adding something else'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can throw
an error here, but i wouldn't return an error message.
I would probably just do nothing if the value is already there
} | ||
} | ||
has(value) { | ||
const objVals = Object.values(this.set); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return this.set.hasOwnProperty(value);
const aVal = aVals[i]; | ||
|
||
if(setB.set[aVal]) { | ||
newSet.set[aVal] = aVal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use your add method
const aVal = Object.values(setA.set); | ||
const bVal = Object.values(setB.set); | ||
|
||
aVal.map(Val => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a forEach not a map
newSet.add(Val); | ||
}); | ||
|
||
bVal.map(Val => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
No description provided.