Interface Set<T>
interface Set<T> {
[toStringTag]: string;
size: number;
[iterator](): SetIterator<T>;
add(value: T): this;
clear(): void;
delete(value: T): boolean;
entries(): SetIterator<[T, T]>;
forEach(callbackfn: ((value: T, value2: T, set: Set<T>) => void), thisArg?: any): void;
has(value: T): boolean;
keys(): SetIterator<T>;
values(): SetIterator<T>;
}
[toStringTag]: string;
size: number;
[iterator](): SetIterator<T>;
add(value: T): this;
clear(): void;
delete(value: T): boolean;
entries(): SetIterator<[T, T]>;
forEach(callbackfn: ((value: T, value2: T, set: Set<T>) => void), thisArg?: any): void;
has(value: T): boolean;
keys(): SetIterator<T>;
values(): SetIterator<T>;
}
Type Parameters
Methods
[iterator]
- [iterator](): SetIterator<T>
Iterates over values in the set.
Returns SetIterator<T>
add
- add(value): this
Appends a new element with a specified value to the end of the Set.
Parameters
- value: T
Returns this
clear
delete
- delete(value): boolean
Removes a specified value from the Set.
Parameters
- value: T
Returns boolean
Returns true if an element in the Set existed and has been removed, or false if the element does not exist.
entries
- entries(): SetIterator<[T, T]>
Returns an iterable of [v,v] pairs for every value
v
in the set.Returns SetIterator<[T, T]>
forEach
has
- has(value): boolean
Parameters
- value: T
Returns boolean
a boolean indicating whether an element with the specified value exists in the Set or not.
keys
- keys(): SetIterator<T>
Despite its name, returns an iterable of the values in the set.
Returns SetIterator<T>
values
- values(): SetIterator<T>
Returns an iterable of values in the set.
Returns SetIterator<T>
Returns
the number of (unique) elements in Set.