Segments

Baseline
Widely available

This feature is well established and works across many devices and 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

Specification
ECMAScript® 2027 Internationalization API Specification
# sec-segments-objects

Browser compatibility

See also