SpeechRecognitionResultList: length 属性
SpeechRecognitionResultList 接口的 length 只读属性返回“数组”的长度,即列表中 SpeechRecognitionResult 对象的数量。
值
一个数字。
示例
此代码摘自我们的 语音变色器 示例。
js
recognition.onresult = (event) => {
const color = event.results[0][0].transcript;
diagnostic.textContent = `Result received: ${color}.`;
bg.style.backgroundColor = color;
console.log(event.results.length);
};
规范
| 规范 |
|---|
| Web Speech API # dom-speechrecognitionresultlist-length |
浏览器兼容性
加载中…