Skip to content

Chapter 07 Sets 7.3 isSubsetOf #168

@rosald

Description

@rosald

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions