Skip to content
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

Chapter 07 Sets 7.3 isSubsetOf #168

Closed
rosald opened this issue Feb 24, 2021 · 3 comments
Closed

Chapter 07 Sets 7.3 isSubsetOf #168

rosald opened this issue Feb 24, 2021 · 3 comments

Comments

@rosald
Copy link

rosald commented Feb 24, 2021

hi
the ‘isSubsetOf’ method is some kind of lengthy
it may be clear like following

isSubsetOf(otherSet) {
if (this.size() > otherSet.size()) {
return false;
}
return this.values().every(value => otherSet.has(value));
}

or remain 'isSubset' variable

const isSubset = this.values().every(value => otherSet.has(value));
return isSubset;

@Jeffzholy
Copy link

Jeffzholy commented May 11, 2022

agree with you, and it could be shorter and cleaner:

isSubsetOf(otherSet) {
    const values = this.values();

    return values.every((value) => otherSet.has(value));
  }

I will raise a PR on this

@Jeffzholy
Copy link

@loiane #191

@loiane
Copy link
Owner

loiane commented May 12, 2022

@Jeffzholy thanks, merged!

@loiane loiane closed this as completed May 12, 2022
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

No branches or pull requests

3 participants