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 |
瀏覽器相容性
載入中…