Firefox Tomorrow

web api instance property

SpeechRecognitionResultList: length property

View on MDN ↗

The length read-only property of the SpeechRecognitionResultList interface returns the length of the “array” — the number of SpeechRecognitionResult objects in the list.

Value

A number.

Examples

This code is excerpted from our Speech color changer example.

recognition.onresult = (event) => {
  const color = event.results[0][0].transcript;
  diagnostic.textContent = `Result received: ${color}.`;
  bg.style.backgroundColor = color;

  console.log(event.results.length);
};

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also