Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
Since June 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Set 인스턴스의 isSubsetOf() 메서드는 하나의 집합을 받아서 이 집합의 모든 요소가 주어진 집합에 있는지 여부를 나타내는 불리언을 반환합니다.
이 Set에 모든 요소가 other Set에 있다면 true를 반환하며, 그렇지 않으면 false를 반환합니다.
수학적 표기법으로 부분집합(subset)은 아래와 같이 표현할 수 있습니다.
A⊆B⇔∀x∊A,x∊BA\subseteq B \Leftrightarrow \forall x\in A,,x\in B벤 다이어그램을 사용하자면 아래와 같습니다.
참고 : 부분집합 관계는 적절한 부분집합이 아니므로 isSubsetOf()는 this과 other에 동일한 요소가 포함되어 있으면 true를 반환합니다.
isSubsetOf()는 유사 Set 객체를 other 매개변수로 받습니다. 사용자 코드를 호출하지 않고 this에 저장된 기본 데이터를 직접 검색하기 때문에 실제 this 인스턴스여야 합니다. 그러면 그 동작은 this와 other의 크기에 따라 달라집니다.
4의 배수(<20)의 Set은 짝수 Set(<20)의 부분집합입니다.
소수(<20)의 Set은 홀수(<20) Set의 부분집합이 아닙니다. 2는 소수지만 홀수가 아니기 때문입니다.
완전 동일한 Set은 서로에게 부분집합입니다.
| ECMAScript® 2027 Language Specification # sec-set.prototype.issubsetof |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2024년 7월 31일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.