Skip to content

Conversation

adoxic
Copy link
Collaborator

@adoxic adoxic commented Oct 24, 2019

No description provided.

if(!this.set[value]) {
this.set[value] = value;
} else {
return 'this is already here try adding something else';

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);

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;

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 => {

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 => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants