Hi makenzi.exc,
Refer below example.
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
body { font-family: Arial; font-size: 10pt; }
</style>
</head>
<body>
<div id="dvText"></div>
<script type="text/javascript">
var speech = true;
window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
var speechRecognition = new SpeechRecognition();
speechRecognition.interimResults = true;
speechRecognition.addEventListener('result', e => {
document.getElementById("dvText").innerHTML = Array.from(e.results)
.map(result => result[0]).map(result => result.transcript)
.join('');
});
if (speech == true) {
speechRecognition.start();
speechRecognition.addEventListener('end', speechRecognition.start);
}
</script>
</body>
</html>
Demo
Screenshot

Downloads
Download Sample