Segments
Baseline Newly available
This feature works across the latest devices and browser versions. This feature might not work in older devices or browser versions. It's been available across browsers since April 2024.
A Segments object is an iterable collection of the segments of a text string. It is returned by a call to the segment() method of an Intl.Segmenter object.
Instance methods
-
Segments.prototype.containing() - Returns an object describing the segment in the original string that includes the code unit at a specified index.
-
Segments.prototype[Symbol.iterator]() - Returns an iterator to iterate over the segments.
Specifications
Browser compatibility
| Desktop | Mobile | Server | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on iOS | Samsung Internet | WebView Android | WebView on iOS | Bun | Deno | Node.js | |
Segments |
87 |
87 |
125 |
73 |
14.1 |
87 |
125 |
62 |
14.5 |
14.0 |
87 |
14.5 |
1.0.0 |
1.8 |
16.0.0 |
@@iterator |
87 |
87 |
125 |
73 |
14.1 |
87 |
125 |
62 |
14.5 |
14.0 |
87 |
14.5 |
1.0.0 |
1.8 |
16.0.0 |
containing |
87 |
87 |
125 |
73 |
14.1 |
87 |
125 |
62 |
14.5 |
14.0 |
87 |
14.5 |
1.0.0 |
1.8 |
16.0.0 |
See also
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter/segment/Segments