Set

suggest change

Introduction

The Set object stores unique values of any type, including primitives and object references.

Values are iterated in insertion order. A value can occur only once, as determined by the SameValueZero comparison algorithm.

ECMAScript specification for Set

Syntax

Parameters

Parameter Details
iterable If an iterable object is passed, all of its elements will be added to the new Set. null is treated as undefined.
value The value of the element to add to the Set object.
callback Function to execute for each element.
thisArg Optional. Value to use as this when executing callback.

Remarks

SameValueZero mostly behaves like strict equality. Its notable differences are that NaN equals itself and +0 equals -0. Objects are still compared by identity, so two separate objects with the same properties are distinct set values. A Set may also contain undefined.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents