The size accessor property returns the number of elements in a Set object.

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

Description

The value of size is an integer representing how many entries the Set object has. A set accessor function for size is undefined; you cannot change this property.

1. From Firefox 13 to Firefox 18, the size property was implemented as a Set.prototype.size() method, this has been changed to a property in later versions conform to the ECMAScript 2015 specification.

Desktop

Mobile

Server

Chrome

Edge

Firefox

Internet Explorer

Opera

Safari

Android webview

Chrome for Android

Edge Mobile

Firefox for Android

Opera for Android

iOS Safari

Samsung Internet

Node.js

Basic support

Full support
38

Full support
12

Full support
19

Notes

Full support
19

Notes

Notes From Firefox 13 to Firefox 18, the size property was implemented as a Set.prototype.size() method, this has been changed to a property in later versions conform to the ECMAScript 2015 specification.

Full support
11

Full support
25

Full support
8

Full support
38

Full support
38

Full support
12

Full support
19

Notes

Full support
19

Notes

Notes From Firefox 13 to Firefox 18, the size property was implemented as a Set.prototype.size() method, this has been changed to a property in later versions conform to the ECMAScript 2015 specification.