Firefox Tomorrow

web api instance property

SpeechSynthesisEvent: charIndex property

View on MDN ↗

The charIndex read-only property of the SpeechSynthesisUtterance interface returns the index position of the character in text that was being spoken when the event was triggered.

Value

A number.

Examples

utterThis.onpause = (event) => {
  const char = event.utterance.text.charAt(event.charIndex);
  console.log(
    `Speech paused at character ${event.charIndex} of "${event.utterance.text}", which is "${char}".`,
  );
};

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also