Set.prototype.clear()
clear()
메서드는 Set
객체를 비웁니다.
시도해보기
구문
js
mySet.clear();
예제
clear()
사용하기
js
var mySet = new Set();
mySet.add(1);
mySet.add("foo");
mySet.size; // 2
mySet.has("foo"); // true
mySet.clear();
mySet.size; // 0
mySet.has("bar"); // false
명세
Specification |
---|
ECMAScript Language Specification # sec-set.prototype.clear |
브라우저 호환성
BCD tables only load in the browser